Forums

Help! "the_content" showing up twice if there is no excerpt (3 posts)

  1. venomshot629
    Member
    Posted 5 months ago #

    Hey all,

    I just got involved in the Wordpress scene, and I am having a little problem. The theme I am using for some reason had the definition and roles of "the_content" and "the_excerpt" switched, so typing anything for the main body of the post would show up in the "read more", and typing anything in the excerpt area of a post would show up on the main page. I dont remember how or where, but I was eventually able to switch the roles of the two... However, now I'm having another problem.

    Now, if I make a post that has no excerpt or read more, and the user clicks the link to view the post on it's own standalone page, the content's words will show up twice! The pictures, though, do not. I have been trying all sorts of things in editing my single.php file, and I am not sure on how to code it so that if there is a "read more" excerpt, to show it below the content, and if there isn't a read more, only show the content... once.

    Here is what I think is the relevant area of the code:

    <div id="post-<?php the_ID(); ?>" class="<?php sandbox_post_class(); ?>">
    			<h3>Entry</h3>
    				<h2 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
    
    				<div class="entry-content"><?php the_content(); ?>
    
    				<div class="excerpt"><?php the_excerpt(''.__('Read More <span class="meta-nav">&raquo;</span>', 'sandbox').''); ?></div>
    <?php if (function_exists('sharethis_button')) { sharethis_button(); } ?>
    
    					<?php wp_link_pages('before=<div class="page-link">' .__('Pages:', 'sandbox') . '&after=</div>') ?>
    				</div>

    I am not sure if that is enough, so please let me know if more information is needed to help solve this problem. Thank you!

  2. venomshot629
    Member
    Posted 5 months ago #

    Anyone? I'm trying to fix the problem today, I was planning on launching the site in the very near future, so any help would be appreciated. Thanks!

  3. bwells
    Member
    Posted 4 months ago #

    Hi, have you tried removing the lines:

    <div class="excerpt"><?php the_excerpt(''.__('Read More <span class="meta-nav">&raquo;</span>', 'sandbox').''); ?></div>

    Excerpts don't contain images or other html, so my best guess is that the excerpt is what is generating the second round of content.

    Let us know if it works!

Reply

You must log in to post.

About this Topic