WordPress.org

Ready to get started?Download WordPress

Ideas

Custom post type page in Settings

  1. Hiranthi
    Member

    12345

    Well, similarly yes. Perhaps this makes it better to understand:

    Posts have the homepage as the default archive, but you have the option to select a Posts-page in the settings (Settings -> Read, from the top of my head). Doing this adds that posts-page in breadcrumbs as parent and the corresponding menu-item gets the parent/ancestor class (when applicable).

    We need the same thing for CPT's. Right now the Posts-page is getting the parent/ancestor class, when viewing a CPT on single-view (and I believe on the archive-page too). Breadcrumbs are also incorrect (not using the archive-page as parent-page).

    Posted: 2 years ago #
  2. Ipstenu (Mika Epstein)
    Administrator

    Ah, okay. That's called setting a STATIC front page for your site, by the way. From that, yes, you can move the 'posts' page.

    Interesting.

    Doing this adds that posts-page in breadcrumbs as parent and the corresponding menu-item gets the parent/ancestor class

    This is actually an incorrect understanding of page parent and inheritance. The breadcrumb trail has nothing to do, in this moment, with your post type or post-type parent, and everything to do with organization.

    Now, remember that Custom Post-types are POST-TYPES, not posts. Posts have different rules, and CPTs are more like pages. You have have a page be a child of another page, but a post cannot be the child of another post. They're 'linear', for lack of a better term (date based?) rather than hierarchical like a page or a CPT. So while a post gets yyyy/mm/postname, a CPT (like a page) only gets postname. This feature is by design, and isn't likely to change any time soon. CPTs are meant to flat out, like a Wiki, with everything at the same level.

    Now that we have that out of the way.

    You cannot make a 'page' and use that for your archive, the same way you can for normal posts. So you cannot make a page called 'My-awesome-CPT' and have it be 'assigned' as the go-to archive page.

    But you can rename CPT archives.

    http://justintadlock.com/archives/2010/04/29/custom-post-types-in-wordpress

    Look up the rewrite capability.

    'rewrite' => array( 'slug' => 'cool', 'with_front' => true ),

    If you change the slug, like the example did, to 'cool', then that would be your archive page.

    On breadcrumbs, which is a different issue....

    A quick check on my site that uses CPTs heavily, and I see: Browsing: / Home / Questions / [post title] in my breadcrumbs when I look at a question. Which makes me think whatever you're using to generate breadcrumbs is the issue, not CPTs themselves (though it's very possible the theme I'm using fixed something).

    Posted: 2 years ago #

RSS feed for this topic

Reply

You must log in to post.

  • Rating

    12345
    6 Votes
  • Status

    This is plugin territory