excerpts on index page do not work. Please help (7 posts)

  1. dmitric
    Posted 5 years ago #

    Good evening.

    I recently started using twenty ten template and I can't seem to make it show excerpts on home page.
    I looked in the loop.php and tried to change <?php the_content(); ?> to `<?php the_excerpt(); ?>' but nothing works.

    Please ,experts,show me exact spot to make excerpts appear on my home page.
    Thank you !

  2. FishDogFish
    Posted 5 years ago #

    You want to change that line in the index.php not the loop.php

  3. Michael
    Forum Moderator
    Posted 5 years ago #

    try to change here in loop.php line 132+:

    <?php if ( is_archive() || is_search() ) : // Only display excerpts for archives and search. ?>
    			<div class="entry-summary">
    				<?php the_excerpt(); ?>
    			</div><!-- .entry-summary -->
    	<?php else : ?>
    			<div class="entry-content">
    				<?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyten' ) ); ?>
    				<?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'twentyten' ), 'after' => '</div>' ) ); ?>
    			</div><!-- .entry-content -->
    	<?php endif; ?>
  4. truthlighthouse
    Posted 5 years ago #

    Hello. I too have lost the ability to show the excerpts on my index page. I know how it started. I installed a plugin a while back that shows the content instead because I wanted to show videos on the home page. However I later realized that that was not the best idea and uninstalled it. However it still does not show the excerpt. Instead, in order to get it to show just an excerpt, I have to put <!--more--> in the post after the part that I want to show on the home page. Now I don't know how to get it to read excerpts again. Any ideas?

    The website is Truth Lighthouse. Also, please note that I know very little PHP code. So if possible it would really help to know which part I should edit and maybe even specifically what line.

    P.S. One thing I have already tried is changing

    <?php the_content('Read More', '<img><a>', 'content', false, 'More...', true);?>
    					<div class="details">


    <?php the_excerpt('Read More', '<img><a>', 'content', false, 'More...', true);?>
    					<div class="details">

    However, all that did was move the "Join the forum" link to inside the excerpt and make it to where it was no longer a link.

    Any ideas?

    Thanks so much!

  5. truthlighthouse
    Posted 5 years ago #


  6. Versipellis
    Posted 5 years ago #

    I use

     $postslist = get_posts('numberposts=5&order=DESC&orderby=date');
     foreach ($postslist as $post) :
     <h2><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a>  </h2>
     <?php the_excerpt(); ?>
     <?php endforeach; ?>

    to show excerps on my custom homepage template. I don't know if this will be useable for you but it shows title and excerpt.

  7. truthlighthouse
    Posted 5 years ago #

    Thanks so much for your response. As soon as you posted that and I reviewed it, I tried something similar and it worked! Basically something I was doing earlier was right but because I had not put anything into the excerpt field, it was reading from the main article instead. So this works. The only catch is that it removed my forum link under each post but I am ok with that. Thanks again!

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.