Forums

[resolved] Problem with title duplicating in the excerpt (3 posts)

  1. teamGool
    Member
    Posted 1 year ago #

    I've recently updated WordPress after about a year at version 2.8.5 and everything is working fine except for one thing I can't rectify.

    I use the_excerpt() in my index.php to summarise my blog posts and since the upgrade, the title of the blog post is being repeated at the start of the excerpt and I can't seem to get rid of it. You can see what I mean at my site: http://www.teamgool.com/blog

    In my functions.php I have the following to extend the excerpt to 100 words and change the ellipses:

    // custom excerpt length for 2.0+
    function new_excerpt_length($length) {
    	return 100;
    }
    add_filter('excerpt_length', 'new_excerpt_length');
    
    // custom excerpt ellipses for 2.9+
    function custom_excerpt_more($more) {
    	return '...';
    }
    add_filter('excerpt_more', 'custom_excerpt_more');

    The thing is, if I change the custom length to 0 then I still get the title appearing where the excerpt is, which leads me to think the title isn't being treated as part of the excerpt because its length isn't being included when the function calculates the length of the excerpt. Yet if I remove the_excerpt() from index.php, I get nothing at all, which indicates the post title is somehow being treated as part of the excerpt. It's very confusing.

    The only thing I can think of is that there's something in wp-includes/post-template.php that is causing this but I haven't edited that file at all, it's just the one included with the latest version of WP.

    Somehow the title as a link is being included in my excerpt, does anybody have an idea why this might be?

    Thanks

    tG

    For reference, here is my index.php:

    <?php
    	get_header();
    ?>
    <div id="container">
    	<div id="content">
    		<?php
    			if (have_posts()) : while (have_posts()) : the_post();
    		?>
    		<div class="entry">
    			<h3 class="entrytitle" id="post-<?php the_ID(); ?>">
    				<a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?>
    				</a>
    			</h3>
    			<div class="entrymeta"> Posted
    				<?php
    					the_time('F j, Y ');
    					$comments_img_link= '<img src="' . get_stylesheet_directory_uri() . '/images/comments.gif"  title="comments" alt="*" />';
    					comments_popup_link($comments_img_link .' Comments(0)', $comments_img_link .' Comments(1)', $comments_img_link . ' Comments(%)');
    					edit_post_link(__(' Edit'));
    				?>
    			</div>
    			<div class="entrybody">
    				<?php
    					the_excerpt();
    				?>
    				<a href="<?php the_permalink(); ?>" title="Read the rest of <?php the_title(); ?>" class="more-link">Click to read on...
    				</a>
    			</div>
    			<img style="border:3px solid black" src="/wp-content/themes/teamGool/images/separator.jpg"/>
    		</div>
    		<?php
    			comments_template();
    		?>
    		<?php
    			endwhile; else:
    		?>
    		<p>
    			<?php
    				_e('Sorry, no posts matched your criteria.');
    			?>
    		</p>
    		<?php
    			endif;
    		?>
    		<p>
    			   <?php posts_nav_link('', __('« Previous Page'), __('Next Page »')); ?>
    		</p>
    	</div>
    <?php
    	get_sidebar();
    ?>
    <?php
    	get_footer();
    ?>
    </div>
  2. keesiemeijer
    moderator
    Posted 1 year ago #

    it's a link to an image that is not there anymore. That's strange because the_excerpt strips all html tags including <img>. Do you use plugins to show post thumbnails?

  3. teamGool
    Member
    Posted 1 year ago #

    Yes! Thank you, it had been so long since I last used my blog I totlaly forgot about the Post Thumbs plugin I was using that broke when I moved the blog location. I've fixed it now and all is well again. Thanks for pointing me in the right direction

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags