WordPress.org

Ready to get started?Download WordPress

Forums

Displaying Excerpts OR Content on the Main page? (3 posts)

  1. Nedyken
    Member
    Posted 7 years ago #

    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.

  2. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    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:

    <?php
    if (is_single()) {
    the_content(__('(more...)'));
    } else {
    the_excerpt()
    } ?>

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

  3. Nedyken
    Member
    Posted 7 years ago #

    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 {
    the_content(__('(more...)'));
    } ?>

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

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags