Support

Account

Home Forums General Issues How to link to Custom post type pages

Solving

How to link to Custom post type pages

  • Hi Ive been trying to use the post object field type to select a custom post type master archive page. For example my custom post type if casestudies which lists all single casestudies, but i cant work out how to select the archive page that shows all casestudies. Is this possible?

  • Ah ok so i worked out it easy to do with page link but then i havent got the same capabilities of the post object field. Does anyone know how to do it with the post object?

  • What you’re looking to do cannot be done with the post object field, not that I’m entirely sure what you’re trying to do. An archive page has nothing in the db, or an admin page. While it exists on the front of the site an archive page does not really exist in any real form.

    Maybe it would help if you explain why you want to select the archive page.

  • Hi John,

    Thanks for response. Apologies if not explained myself clearly, i’m confusing myself,! I think i need to learn more about basic template hierarchy foremost. B

    Basically i want to pick the page that loops through the casestudies. Currently that page is a archive-custom.php file and works ok. But i think i might need to create a custom page template that loops through that archive page instead.

  • Yes, the WP template hierarchy can be one of the difficult things to understand. I’ve tried to explain archive pages to clients and even to the people I work with/for. “I can see the page on the front end, why can’t I change the content?”

    Anyway, if you are wanting to show the list of case studies on the front end than the template you mentioned, well I don’t know what file archive-custom.php is. If you’re custom post type is case-study then I would expect it to be archive-case-study.php. Is archive-custom.php a file that is supplied by the theme you’re using?

    What do you want to do with the archive template file that it’s not doing.

  • sorry i used archive-custom.php just as an example, it was archive-case-study.php. I’ve ended up just creating a custom loop on a custom page template which fullfills my needs until i learn more about archive pages. many thanks for the help

  • Having the same issue here and do not really want to change the ACF field to a post field. As a last case scenario, you could create a page that then redirects to the custom post archive page.
    In my scenario, I was creating a directory page listing all of the common types of pages I’d want to be linking to. Therefore the custom post type archive page was one of them.

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.