Support » Fixing WordPress » Displaying Excerpts OR Content on the Main page?

  • Hey. I’m new to all of this, but im making a lot of progress. I wanted to be able to sometimes display excerpts on the main page and sometimes the full content (and sometimes partial content using the “MORE” tag). Finally after getting confused a bunch, I realized I could edit my index.php file and add <?php the_excerpt(); ?> above <?php the_content(__(‘(more…)’)); ?>

    So if I create a post with a ton of content, I can use the MORE tag to hide it on the main page and it will display what I wrote in the “optional excerpt” field instead. It seems to work great. The problem I’m having now is that when you click on the actual post to “read more content”, it not only displays the content, but also shows the excerpt right above it. That kind of eliminates the point since I could have accomplished the same thing by just using the MORE tag… Please help. I’m a n00b.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator Samuel Wood (Otto)

    (@otto42) Admin

    Sounds to me like you’re going about this all wrong.

    You want the excerpt on the main page, but the content on the single pages, correct? Then do this:

    if (is_single()) {
    } else {
    } ?>

    That will display the content on the single pages and the excerpt on the rest. No more tags needed.

    I installed the “excerpt reloaded” addon and then used this code:

    <?php if(is_home()) {
    the_excerpt_reloaded(120, ‘<img>’, ‘filter_type’, use_more_link, ‘more_link_text’, force_more_link, fakeit, fix_tags); the_content(__(‘(more…)’)); } else {
    } ?>

    Seems to work… on the main page I now have the option of having html excerpts, full content, or partial content with “more”…

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Displaying Excerpts OR Content on the Main page?’ is closed to new replies.