Ask your WordPress questions! Pay money and get answers fast! (more info)

Loop interfering with breadcrumb trail for some reason? WordPress

  • SOLVED

For some reason, there's a loop at the top of my page that pulls the "featured" tag posts and it's interfereing with my breadcrumbs by misidentifying the page as "Featured" instead of its post title.

It only happens on my single.php pages since that's where I currently have the loop.

Here's my single page:

http://theurbantwist.com/2013/11/01/wife-kicks-husband-house-left-lustful-comment-underneath-models-pic/

And here's just a page where I haven't yet implemented the loop:

http://theurbantwist.com/about/write-for-us/

You notice the difference between the breadcrumb trails?

It's probably a small fix, but I've been playing around with the code and can't figure it out.

Here's the code for my single page



<?php get_header(); ?>

<div class="mainFrame noMarginTopWithContent">

<div class="mainFrameModule contentTopModule">
<?php
query_posts(array(
'tag' => 'featured',
'posts_per_page' => 3
));
while (have_posts()) : the_post(); $i++; ?>
<a href="<?php the_permalink(); ?>" class="contentTopModuleContent">
<?php if (has_post_thumbnail()) { ?>
<?php the_post_thumbnail('feat-bar-top'); ?>
<?php } ?>
<span><?php the_title(); ?></span>
</a>
<?php endwhile; ?>
<div class="contentTopModuleShadow clear"></div>
</div>
<div class="leaderboard">
<?php if (function_exists('oiopub_banner_zone')) oiopub_banner_zone(1, 'center'); ?>
</div>
<div class="clear"></div>
<ol class="mainFrameModule breadCrumbs">
<?php if ( function_exists('yoast_breadcrumb') ) {
yoast_breadcrumb('<p id="breadcrumbs">','</p>');
} ?>
</ol>
<div class="mainFrameModule last">
<div class="leftColumn">

<!-- Start Recent Popular Recommended Module -->
<div id="ArticleList">

<?php
wp_reset_query();
while (have_posts()) : the_post();
?>

<div class="cbody">

<div class="Dtitle"><?php edit_post_link(__('Edit Post'), ' ( ', ' ) '); ?><h1 class="article-title"><?php the_title(); ?></h1></div>



<div class="byline h12">
<div class="flt">
<?php echo get_avatar(get_the_author_ID()); ?>
</div>
<div class="flt">
BY <?php the_author_posts_link(); ?> <span class="twitter_gray">@<a href="http://twitter.com/<?php the_author_meta('twitter'); ?>" target="_blank"><?php the_author_meta('twitter'); ?></a></span></a>
<span class="lined">|</span>
<span class="timeago"><?php the_time('F j, Y') ?> at <?php the_time() ?></span><span class="lined">|</span>
<span class="comlg"></span><a href="#comments" class="h12 comment-count"><span data-lf-article-id="229415" data-lf-site-id="334706" class="livefyre-commentcount"><?php comments_number(); ?></span></a>
</div>

<div class="clear"></div>

</div>

<div style="position:relative;" class="cb TopImage">
<?php if (has_post_thumbnail()) { ?>
<?php the_post_thumbnail('featured'); ?>
<?php } ?>
</div>

<div class="Dcaption h6"></div>
<div class="Dtitle"><h2><?php the_excerpt(); ?></h2></div>

<div class="Dtools" id="shareBarDivTop_gig_containerParent">

<?php echo sharing_display(); ?>

</div>

<div class="nlopt" id="article">

<?php the_content(); ?>
</div>

<div class="fb-like-container">
<span class="fb-like-container-text">Like us on Facebook:</span>
<div class="fb-like fb_edge_widget_with_comment fb_iframe_widget" data-href="http://facebook.com/theurbantwist" data-width="450" data-show-faces="false" data-send="false" fb-xfbml-state="rendered"><span style="height: 24px; width: 450px;"><iframe id="f30cb3167" name="f32670c4b" scrolling="no" title="Like this content on Facebook." class="fb_ltr" src="http://www.facebook.com/plugins/like.php?api_key=141861192518680&amp;channel_url=http%3A%2F%2Fstatic.ak.facebook.com%2Fconnect%2Fxd_arbiter.php%3Fversion%3D27%23cb%3Df2ea747c4%26domain%3Dwww.theurbantwist.com%26origin%3Dhttp%253A%252F%252Fwww.theurbantwist.com%252Ff2a48afdcc%26relation%3Dparent.parent&amp;colorscheme=light&amp;extended_social_context=false&amp;href=http%3A%2F%2Ffacebook.com%2Ftheurbantwist&amp;layout=standard&amp;locale=en_US&amp;node_type=link&amp;sdk=joey&amp;send=false&amp;show_faces=false&amp;width=450" style="border: none; overflow: hidden; height: 24px; width: 450px;"></iframe></span></div>
</div>


<div class="Dbio h12 cb">
<a rel="author" href="/author/stephen-key" class="flt"><?php echo get_avatar(get_the_author_ID()); ?></a>
<div class="contnpb">
<div class="contnpb">
<div class="flt"><h5><?php the_author_posts_link(); ?></h5></div>
</div>
<p><?php echo get_the_author_meta('description'); ?></p>
</div>
</div>

<div class="moretopics">
<?php the_tags('', '', ''); ?>
</div>

<div style="padding:0 0 25px;" class="ChList">
<div class="cb">
<div>
<h3 class="sectionbarnp">You Might Be Interested In</h3>
<div class="contnpb">
<div data-src="<?php the_permalink(); ?>" class="OUTBRAIN" ></div>
<script type="text/javascript">(function() {
window.OB_platformType = 8;
window.OB_langJS = "http://widgets.outbrain.com/lang_en.js";
window.OBITm = "1369664440945";
window.OB_recMode = "brn_strip";
var ob = document.createElement("script");
ob.type = "text/javascript";
ob.async = true;
ob.src = "http" + ("https:" === document.location.protocol ? "s" : "") + "://widgets.outbrain.com/outbrainLT.js";
var h = document.getElementsByTagName("script")[0];
h.parentNode.insertBefore(ob, h);
})();</script>
</div>
</div>
</div>
</div>
<div id="news-sub">
<div id="gf_mailing_list" class="centered">

Join The Urban Twist (TUT) and get Instant Updates. We'll also notify you with Great Deals, Discounts and other Interesting Tips. We won't SPAM or SHARE your Email Address with anyone.

<div style="width:610px;margin-top:10px;background:#e2e2e2;padding:10px;float:left;"><form action="http://theurbantwist.us2.list-manage.com/subscribe/post?u=0a7f28ffb7f3c9fd60ac8e5d3&amp;id=35c7076d49" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" target="_blank">
<ul id="signupform">
<li>
<div class="input-email-bg"><input type="text" name="EMAIL" id="mce-EMAIL" class="input-email" value="Enter your email address here" onblur="if (this.value == '') {
this.value = 'go for it.. enter your email here';
this.style.color = '#ADADAD';
}" onfocus="if (this.value == 'go for it.. enter your email here') {
this.value = '';
this.style.color = '#ADADAD';
}" maxlength="50" /></div></li>

<li><input type="submit" name="subscribe" id="mc-embedded-subscribe" value="subscribe" /></li>

</ul>
</form></div>
</div><!-- end email form -->


</div>

<?php comments_template(); ?>


</div>


<?php endwhile; ?>







</div>

</div>
<div class="rightColumn">
<?php get_sidebar(); ?>
</div>
<div class="clear"></div>
</div>
<?php get_footer(); ?>
</div>



Thanks!

Answers (1)

2013-11-10

Hariprasad Vijayan answers:

Hello,

Add <?php wp_reset_query(); ?> after your query posts loop. Hope it will work.


Hariprasad Vijayan comments:

Hello,

Add <?php wp_reset_query(); ?> after your query posts loop. Hope it will work.


Hariprasad Vijayan comments:

Then your query posts code will like


<?php

query_posts(array(

'tag' => 'featured',

'posts_per_page' => 3

));

while (have_posts()) : the_post(); $i++; ?>

<a href="<?php the_permalink(); ?>" class="contentTopModuleContent">

<?php if (has_post_thumbnail()) { ?>

<?php the_post_thumbnail('feat-bar-top'); ?>

<?php } ?>

<span><?php the_title(); ?></span>

</a>

<?php endwhile; ?>
<?php wp_reset_query(); ?>


Brennen Jones comments:

Yessir! That did the trick! :-)

I knew it was something simple, lol


Hariprasad Vijayan comments:

Nice to hear. :-)

Cheers..