Support » Fixing WordPress » Why is my loop exhibiting strange behavior? Please help!

  • trusktr

    (@trusktr)


    For some odd reason, when I use the_content() and the post has “more” content, then that post will have 4 “more” links on the homepage. Only one of them will contain the string passed into the_content().

    For example, if I use the_content(‘Expand…’) then there will be one visible link that says “Exapand…” and three other links of 0 dimensions with no text. You can’t tell they’re there unless you look in the source code. It makes no sense.

    To see the duplicate links, check out the source at keepskatinbro.com, the first post box.
    EDIT: Don’t check it, i fixed it, but i think i found a bug with wordpress?… see below.

    Here’s the code i’m using just for the loop, which is apparently wrong because if i replace it with twentyten’s while loop, then i don’t have the problem:

    <?php while (have_posts()) : the_post(); ?>
    		<div class="box" id="<?= $post->ID ?>">
    			<div class="post_wrap">
    				<h2><a class="ajax_trigger_open" id="open_<?= $post->ID ?>" href="<?php the_permalink(); ?>" rel="<?= $post->ID ?>"><span><?php the_title(); ?></span></a></h2>
    				<?php if ( has_post_thumbnail() ){ ?>
    					<?php $thumbID = get_post_thumbnail_id($post->ID); ?>
    					<div class="thumbnail_wrapper">
    						<a class="ajax_trigger_open" id="open_<?= $post->ID ?>" href="<?php the_permalink(); ?>" rel="gallery" title="<?php the_title(); ?>">
    							<?php the_post_thumbnail(); ?>
    							<!--<span class="view-large"></span>-->
    						</a>
    					</div>
    				<?php } ?>
    				<div class="entry-content">
    					<?php the_content( __('<p>Expand →</p>', 'whatever') ); ?>
    				</div>
    				<?php edit_post_link('Edit this post'); ?>
    			</div>
    		</div>
    	<?php endwhile; ?>

    Any idea what’s wrong?

Viewing 1 replies (of 1 total)
  • Thread Starter trusktr

    (@trusktr)

    Ok, so I determined what the difference is between TwentyTen and my theme that causes this bug:

    My code:

    <div class="entry-content">
    	<?php the_content( __('<p>Expand →</p>', 'whatever') ); ?>
    </div>

    TwentyTen’s code:

    <div class="entry-content">
    	<?php the_content( __( 'Continue reading <span class="meta-nav">→</span>', 'twentyten' ) ); ?>
    	<?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'twentyten' ), 'after' => '</div>' ) ); ?>
    </div><!-- .entry-content -->

    This tiny small difference is the difference between bug and no bug. If i replace my three lines with TwentyTens, all is well.

    Why would mine (simpler) produce 4 (four) .more-link anchor tags???

    I think this might be a bug. It’s so weird!!! Switching between those snippets inside my loop is the only difference that toggles this problem.

Viewing 1 replies (of 1 total)
  • The topic ‘Why is my loop exhibiting strange behavior? Please help!’ is closed to new replies.