[Resolved] [Plugin: Breadcrumb NavXT] Breadcrumb Links Don't Change To Say Page You're On…
Hey, great plugin, but we’re having a problem with the same breadcrumb links being displayed no matter what post we’re on.
For example: The page “Brand New Post for Breadcrumbs” displays “Home > Video Game Reviews > Video Game Reviews (2011): Test Post” instead of what it should be displaying which would be “Home > In Theaters > Brand New Post for Breadcrumbs “
You can see what I’m talking about here on our site’s test website: http://tinyurl.com/4wjfjf4
Yeah, don’t use the $post variable in secondary/custom loops. If you must use $post, you must restore it back to its original state after you are done with your secondary loop.
Sorry, I’m not that familiar with customizing loops, any advice on how I can go about restoring it back to its original state because it looks like the theme needs $post. Although, I’m not 100% sure if the theme needs $post either…
Whatever code is generating the six articles on the top of the page is the $post variable abuser (the stuff inside of the ul with class “highlights2”). I’d bug the creator of it to fix their stuff.
Unfortunately, the theme is heavily modified, and besides the breadcrumbs plugins, everything else seems to function fine with the modifications. You’re right about where the problem is. Each one of the six articles in the top is generated by this code:
<ul class="highlights2"> <?php $highlight7 = new WP_Query("meta_key=thumbnail&cat=".get_wpn_config('highlights_category_id_7')."&showposts=1"); while($highlight7->have_posts()) : $highlight7->the_post(); $highlightcat7 = get_wpn_config('highlights_category_id_7'); $highlightcatname7 = get_cat_name( $highlightcat7 ); $cat7_string.='<a href="'.get_category_link( $highlightcat7 ).'">'.$highlightcatname7.'</a>';?> <li> <?php if(get_post_meta($post->ID, "thumbnail", true)) : ?> <a href="<?php the_permalink(); ?>" class="thumbnail"><img src="<?php echo get_post_meta($post->ID, "thumbnail", true); ?>" /></a> <?php endif; ?> <span class="title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></span> <span class="cat"><?php echo $cat7_string; ?></span> </li> <?php endwhile; ?> </ul>
it looks like this part of that code is what causes the problem: `<?php $highlight7 = new WP_Query(“meta_key=thumbnail&cat=”.get_wpn_config(‘highlights_category_id_7’).”&showposts=1″); while($highlight7->have_posts()) : $highlight7->the_post();
$highlightcat7 = get_wpn_config(‘highlights_category_id_7’);
$highlightcatname7 = get_cat_name( $highlightcat7 );
$cat7_string.='<a href=”‘.get_category_link( $highlightcat7 ).'”>’.$highlightcatname7.'</a>’;?> (code that isn’t causing the error) <?php endwhile; ?>`
If you look at the part that is causing the error, it doesn’t actually contain the $post. Since it looks like I can’t edit it without it breaking my desired functionality, how can I restore it back to its original state after it’s done?
Ok, that’s interesting. I’m going to have to look into this a little more.
Ok, after looking into this a little, you should try calling
wp_reset_query()after that custom loop code. See http://codex.wordpress.org/Function_Reference/wp_reset_query for more information on that function. Let me know if that resolves the issue.
yep, that fixed it! really appreciate you going out of your way to help solve the problem, thanks again! 🙂
- The topic ‘[Resolved] [Plugin: Breadcrumb NavXT] Breadcrumb Links Don't Change To Say Page You're On…’ is closed to new replies.