Support » Fixing WordPress » Custom Post Types – confused

  • Resolved trixienolix


    SO i’m trying to use Custom post types for a change so that I learn something new.
    I am completely stumped by a few things. Cany anyone clarify?

    I want to have a page with a list of my custom post types showing i.e. like the default category.php but for custom post types. I look on the codex and it says that the hierarchy for CPT is archive.php then index.php. So i add my loop to archive.php… how then do I view this list of CPT? What’s the URL? If I view my individual CPT i see the url:
    SO I want to access the page:
    that would list all my CPTs. However this page does not exist.

    Then i read that I need to add the loop to page.php… how come this is not listed in the template hierachy for CPTs?

    I think this shows my lack of understanding of CPTs. I want them to be a substitute for categories and posts I suppose but it looks as though they are not.

    Please can someone explain?!

Viewing 6 replies - 1 through 6 (of 6 total)
  • you enable an archive, and give it a url, using has_archive
    look for has_archive here, you enable it when setting the CPT, you can then give it a slug, which will become your archive page for that CPT
    is also helpful

    Blimey! It was that simple! Thank you, thank you…

    ANother quickie if anyone can help…
    On the WP menu admin page I have my CPT coming up with a list of the “posts” underneath that I can add to the menu.

    How can I get a list of the CPT archive pages here so people can easily add the archive listings to the menu (like you can with categories)?

    Moderator keesiemeijer



    Try to add the custom post type archive as a “custom link”.

    thanks keesiemeijer – yes I can do that, just wondering if there was a more user-friendly way than that. Not a big problem if not as custom links will do the job.

    One thing to note for anyone doing the has_archives code: mine didn’t work for a while then I read about flushing permalinks… just go to your settings > permalinks page, change hte permalink structure to anything (default?), save, then change back to the one you want and sava gain – made it work for me

    Thanks everyone

    actually, I believe just visiting the permalinks page flushes them…. if not then hitting save definitely does, no need to actually change the settings.

    But definitely do remember to flush anytime you add a CPT (or custom taxonomy)

    thanks rev voodoo.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Custom Post Types – confused’ is closed to new replies.