WordPress.org

Ready to get started?Download WordPress

Forums

Breadcrumb NavXT
[resolved] Parent Page > Sub Page > Post (6 posts)

  1. Charlie Davidson
    Member
    Posted 2 years ago #

    Hi There,

    Does anyone know if there is anyway to group pages and posts to get the following setup in the breadcrumb:

    Parent Page > Sub Page > Post

    Many thanks in advance!

    Cheers
    Charlie

    http://wordpress.org/extend/plugins/breadcrumb-navxt/

  2. John Havlik
    Member
    Plugin Author

    Posted 2 years ago #

    You can get this if Sub Page is set as your "Page for Posts" in the Reading settings for WordPress. Note that this will be for all posts. If you are trying to segragate posts (by category or something) do not try to use pages as a substitute for taxonomy archive pages.

  3. Charlie Davidson
    Member
    Posted 2 years ago #

    Thanks for the response mtekk. Unfortunately not quite what I'm looking for. I basically have the following setup:

    Level 1: Continents(page)
    Level 2: Countries (page)
    Level 3: City/Town (page)
    Level 4: Article on City/Town (post)

    I'm trying to get the breadcrumb to reflect this. See examples here:

    Post: http://whatstodo.in/london/if-you-dont-move-to-london-you-will-die-disappointed/
    Page: http://whatstodo.in/london

    If anyone can think of anything that would be awesome!

    Cheers
    Charlie

  4. rjadams96@gmail.com
    Member
    Posted 1 year ago #

    I was search for a way to do this and came across this post. I decided to write my own function to do this:

    <?php
    
    						if (!is_home()) {
    							echo "<ul class='breadcrumb'>";
    							echo '<li><a href="' . get_option('home') . '">' . bloginfo('name') . '</a> <span class="divider">/</span></li>';
    
    							$parents = get_post_ancestors( $post->ID );
    							foreach($parents as $parent){
    								echo '<li><a href="' . get_permalink($parent) . '">' . get_the_title($parent) . '</a>  <span class="divider">/</span></li>';
    							}
    
    							if (is_page()) {
    								echo '<li class="active">' . the_title() . '</li>';
    							}
    							echo "</ul>";
    						}
    
    					?>
  5. John Havlik
    Member
    Plugin Author

    Posted 1 year ago #

    Extra code is no longer necessary, this is now supported via the "Post Parent" post hierarchy option and using something like https://github.com/mtekk/Post-Parents to set the parent page for a post.

  6. brendanmcoffey
    Member
    Posted 1 year ago #

    Thank you. Post-parents is exactly what I was looking for. I have a News page on my site (not the page that is set when selecting a static home page, that is left blank) so when I would navigate to a blog post, I could never get that News page to show up in my breadcrumbs.

    It would be helpful to add a note informing users that they can add a parent to their posts, but that it requires an extra plugin. When I was trying to figure this out, I was trying various settings and when I found the radio button in the NavXT settings, in Post Types > Post Hierarchy, and I toggled 'Post Parent', it did nothing. A note next to this item with a link to the Post-Parents github would help tremendously!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic