[Support request] How to edit page template for custom post type

Home Forums Support How to edit page template for custom post type

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1481008
    Jim

    Earlier I made a custom post type called ncpage. It’s supposed to be a page-type. To edit the page template for it, I just took a copy of page.php, renamed it single-ncpage.php, commented out the parts about building sidebar and comment sections, and put it in the child theme. It worked fine.

    Now with the new way templates work, I can’t figure it out. There are functions for building the template. I’ve tried to track them but can’t find filters or hooks to do the above. Can you help with that?

    #1481107
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    The “old” way of building page templates still works in GP 3.0 the same it did in 2.x.

    Is something not working now that you updated?

    #1481216
    Jim

    Thanks. Keeping the custom template based on the old template file still works. But I understood one should migrate their custom templates when the template file is updated. And if I needed to do it now and didn’t have the old theme template file, I wouldn’t know how to do it.

    I also had a custom 404 page. I was able to update that by tracing from the new 404.php to content-404.php, and saw the generate_404_text filter there I could use, so don’t need a custom template anymore. I thought maybe there was something similar I could do with the custom post type.

    #1482521
    Tom
    Lead Developer
    Lead Developer

    You should definitely compare the files and make any updates to the markup/hooks/filters. However, you can keep the custom parts of the file as they are without any issues 🙂

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.