WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] CPT Template Heirarchy..Sometimes home page, sometimes not? (23 posts)

  1. Rev. Voodoo
    Volunteer Moderator
    Posted 3 years ago #

    Okee, this isn't a huge deal, but I'd like to see what the deal is.
    I would never have noticed this if not trying to sort out some SEO stuff.

    Anyway, I've installed an SEO plugin for meta junk, and breadcrumbs. That made me notice that (you can see the issue in the breadcrumb on each page)
    http://www.rvoodoo.com/hockey/
    This page is a subpage of Home. This is good, its what I want. Each CPT page is not home.

    http://www.rvoodoo.com/who-are-the-voodoo-empire/
    This page comes up in the breadcrumb as home. (it is registered exactly the same as the above link, except I didn't enable categories and tags)

    http://www.rvoodoo.com/the-voodoo-empire-shop/
    This page also thinks its Home. The only difference in this when registered is a custom taxonomy.

    So all 3 CPTs are registered the same in code. All 3 have similar settings in my SEO plugin. Why do 2 pages think they are home, but one doesn't? I would like for them all to not think they are home, so I can get proper breadcrumbs, and meta stuff

    All 3 pages are top level (no parent), all 3 use custom templates (the only difference between templates is query by CPT and layout stuff). I can't see any difference, or reason for this? It also keeps current class from being applied to the menu items for these for css purposes. I have found info about that, but the solutions offered only act as workarounds to get the class applied. They don't remedy the situation

  2. esmi
    Forum Moderator
    Posted 3 years ago #

    How did you register the CPTs?

  3. Rev. Voodoo
    Volunteer Moderator
    Posted 3 years ago #

    http://wordpress.pastebin.com/1CJQkTPv

    col_avs CPT is the one behaving correctly

  4. Rev. Voodoo
    Volunteer Moderator
    Posted 3 years ago #

    Tried working through this some more.... just can't figure it out.

    I resaved everything, rechecked the code, reset the permalinks. Nothing. And I can't seem to find anything that would even suggest the difference?

  5. esmi
    Forum Moderator
    Posted 3 years ago #

    I noticed that two of the CCPTs are non-hierarchical whilst the third (Members) is hierarchical. Is there any correspondence between hierarchy and breadcrumb functionality?

    Is the plugin generating the breadcrumb?

  6. Rev. Voodoo
    Volunteer Moderator
    Posted 3 years ago #

    Doesn't seem to be. As the col_avs post is the only one functioning the way I'd expect. I actually tacked that heirarchical onto the members posts after starting this thread, to see if maybe that would fix it.

    The breadcrumb is from the plugin. But the issue must be on the WP end (either WP itself, or my theme I guess) because of the current issue. When I'm on the col-avs page (Hockey News in my menu) then that tab gets the current-menu-item class. But when I'm on the other two, members, and products, the home page is getting the current-menu-item class for some reason?

  7. esmi
    Forum Moderator
    Posted 3 years ago #

    But the issue must be on the WP end

    Not necessarily. I've just been working on a theme that has an inbuilt breadcrumb. Getting a breadcrumb to work consistently with custom posts types when you don't know what custom types have been set up is tricky. One possibility is that the plugin's author may have made an unconscious assumption about site's taxonomy (which I originally did) or has developed the plugin to work with CTs using a particular set up (which I've probably done). The end result may be a breadcrumb that is sometimes unpredictable.

  8. Rev. Voodoo
    Volunteer Moderator
    Posted 3 years ago #

    The end result may be a breadcrumb that is sometimes unpredictable.

    Right, but it seems to me when looking at the 'current-menu-item' issue that it is not related to the plugin? It seems the plugin is just picking up what wordpress is throwing down.

    WP assigns my members and products pages as home, as is apparent by the fact that 'current-menu-item' is applied to home rather than the appropriate pages in my nav menu. So the breadcrumb also assigns home

    WP assigns my hockey page as its own page. As is apparent by the fact that 'current-menu-item' gets assigned to the actual page, and not home just for this one CPT page. The breadcrumb here just reflects that by showing this page as Home << Hockey

    so its the assignment of current-menu-item to the pages in an unpredictable manner that has me thinking this is a WP or theme issue. 2 pages are considered home, while one is considered a sub to home in my nav menu

    (btw, thanks for sticking with me so far.....this is pretty much driving me nuts... its a little issue, but I hate unpredictability, all pages should either come up one way or the other I would think)

  9. esmi
    Forum Moderator
    Posted 3 years ago #

    it seems to me when looking at the 'current-menu-item' issue that it is not related to the plugin? It seems the plugin is just picking up what wordpress is throwing down.

    Could the plugin be interfering with the 'current-menu-item' class?

    Can you email me a copy of the plugin? Or point me towards the download url? If I try running it locally and get the plugin to dump some of its variables, I might be able to figure out what is going on.

  10. Rev. Voodoo
    Volunteer Moderator
    Posted 3 years ago #

    I'm mobile right now, so grabbing the url is kind of hard. But its yoast's wordpress seo if you care to check it out. Very generous offer, thank you!

  11. esmi
    Forum Moderator
    Posted 3 years ago #

    Found it. I'll try and have a look at it over the next few days.

  12. Rev. Voodoo
    Volunteer Moderator
    Posted 3 years ago #

    Thanks very much!

    http://wordpress.org/support/topic/missing-current_page_parent-css-class-for-custom-post-types?replies=11
    http://themehybrid.com/support/topic/how-to-add-current-menu-item-class-for-custom-post-type
    http://wordpress.stackexchange.com/questions/3014/highlighting-wp-nav-menu-ancestor-class-w-o-children-in-nav-structure

    It seems cruising around the google, that quite a few people are running into this issue. Folks are coming up with workarounds for applying the css class, but the problem runs deeper than that.

  13. Root
    Member
    Posted 3 years ago #

    In an app with dynamically generated content I never understood what "home" meant anyway

  14. Rev. Voodoo
    Volunteer Moderator
    Posted 3 years ago #

    lol...what I want it to mean is my front page the page you land on when you go to domain.com

    Currently it seems to refer to 4 different pages!

  15. Rev. Voodoo
    Volunteer Moderator
    Posted 3 years ago #

    OK, just ran a check I probably should have done a while ago. I deactivated the WordPress SEO plugin, problem remains.

    The breadcrumb thing I guess, just helped me notice the problem. But with the plugin turned off, 1 of the pages still gets assigned current-menu-item, while the other two do not

  16. esmi
    Forum Moderator
    Posted 3 years ago #

    Could you create a very quick child of Twenty Ten, add your CPTs to the child's functions.php file and try the child theme? It might help to refine where the issue is.

  17. Rev. Voodoo
    Volunteer Moderator
    Posted 3 years ago #

    Sure thing..... it'll be a few, but I'll get on it asap

  18. Rev. Voodoo
    Volunteer Moderator
    Posted 3 years ago #

    OK, testing is done. On the child theme, none of the CPT template pages registered as current-menu-item.

    I made the theme, added the CPTs and the 1 custom tax, exactly per my original theme. I then made 3 page templates to assign to the 3 CPTs, again exactly as my theme.

    When visiting any of the CPT template pages, the current-menu-item stayed on Home.

  19. Rev. Voodoo
    Volunteer Moderator
    Posted 3 years ago #

    And the plot thickens.....

    So, when I just query a CPT, it's all fail. The pages register as Home.

    I just realized that for the one CPT, on the template page I was also querying a category from normal posts. That's the difference.

    So if normal posts and CPTs are together on the page, it will register properly as current-menu-item, and display properly in my breadcrumbs.

    If its just CPT, it fails, and does none of that

  20. Rev. Voodoo
    Volunteer Moderator
    Posted 3 years ago #

    Hmmm, I wonder if the new CPT archive feature coming in 3.1 will remedy this problem? If so, I'm happy to wait!

  21. esmi
    Forum Moderator
    Posted 3 years ago #

    It might be worth adding this as a possible bug in Trac.

  22. Rev. Voodoo
    Volunteer Moderator
    Posted 3 years ago #

    http://core.trac.wordpress.org/ticket/13543

    seems like comment 13 kind of touches on this, but it seems to go deeper than just the nav menu.... but I'm not sure totally......

    I may wait it out for 3.1 and go from there, since there are changes afoot

  23. Rev. Voodoo
    Volunteer Moderator
    Posted 3 years ago #

    OK, its looking good

    I just started digging into 3.1 on my dev install. The current-menu-item issue has resolved. So that's the biggie. I haven't added in the same plugins yet or anything to test fully, but 3.1 is looking good as a fix

Topic Closed

This topic has been closed to new replies.

About this Topic