Support » Plugin: Breadcrumb NavXT » [Plugin: Breadcrumb NavXT] Parent Page > Sub Page > Post

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author John Havlik

    (@mtekk)

    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.

    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

    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>";
    						}
    
    					?>
    Plugin Author John Havlik

    (@mtekk)

    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.

    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!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Plugin: Breadcrumb NavXT] Parent Page > Sub Page > Post’ is closed to new replies.