archives - Create page like custom post type list in Wordpress

I would like to know if I can have a page in WP that works like archive.php for my custom post type.I would like that it

I would like to know if I can have a page in WP that works like archive.php for my custom post type.

I would like that it works like when in Settings -> Reading I choose an static page like Posts page.

Thank you!

I would like to know if I can have a page in WP that works like archive.php for my custom post type.

I would like that it works like when in Settings -> Reading I choose an static page like Posts page.

Thank you!

Share Improve this question edited Jun 30, 2019 at 14:07 fuxia 107k39 gold badges255 silver badges459 bronze badges asked Jun 28, 2019 at 9:13 fcastillofcastillo 992 bronze badges 4
  • 1 If your post type has has_archive set to true, then these get created dynamically. Go to http://yourdomain/post-type-slug and you'll see it. The template that's used will be determined by the template hierarchy. Is that what you're after? – Jacob Peattie Commented Jun 28, 2019 at 9:18
  • Yes, but then I don't have the custom post meta that I have in a static Page :( – fcastillo Commented Jun 28, 2019 at 9:46
  • Maybe give github/humanmade/page-for-post-type a go. – Jacob Peattie Commented Jun 28, 2019 at 9:58
  • I tried that plugin but doesn't work. Don't worry, I will do creating a shortcode. Thank you!! – fcastillo Commented Jun 28, 2019 at 10:14
Add a comment  | 

1 Answer 1

Reset to default 0

One option is to set has_archive to false when you register the CPT. Then, create a Page with the same slug. So if your CPT is "mycpt" then create a Page at http://example/mycpt/.

From there, set up a custom Page template to act like an archive, but you can also (optionally) add content in the Page itself to appear above or below the individual CPT posts. You'll also be able to add all the regular Page attributes like postmeta.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745357776a4624219.html

相关推荐

  • archives - Create page like custom post type list in Wordpress

    I would like to know if I can have a page in WP that works like archive.php for my custom post type.I would like that it

    4小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信