Need help? Check out our Support site, then


How do I display Excerpts OR Content on the Main page?

  1. 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. Since you've been here a total of nine minutes and your name isn't linked to a blog here at wp.com, I'm going to assume that you're hosted elsewhere. You're running different software than we are here. The differences are covered in the "Please read me first before posting" stickie at the head of these forums.

    Please head over here -> Http://wordpress.org/support

    But to answer your question, the two functions can't be used together like that. It's one of the other. That's why you're getting dupes.

    Good luck,
    -drmike

  3. Like I said, Mike... I'm a n00b. I just googled "wordpress support forum" and found this place.

    But Mike if it's "one or the other", then that means if I use JUST <?php the_excerpt(); ?> then it will only display excerpts on my main page... and then when you click on the article... it'll only display the excerpt again....

  4. You put the the_content function within the single.php page as that's what is used for displaying a single article.

    Or does the theme only have an index.php page? If that's the case, you're going to have to write your own single.php file for the theme.

  5. Heres what I came up with Drmike:

    <?php if(is_category() || is_home()) {
    the_excerpt();
    } else {
    the_content();
    } ?>

    That seems to work. That will display an excerpt (if one exists) on the main "home" page... otherwise it will display content. But for some reason that made it so that on the home page, it isn't showing html (images and such) on the main page.

  6. 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 can have html excerpts, full content, or partial content with "more"...

  7. I'm steering you back to http://wordpress.org/support as we are asked not to confuse bloggers by giving wordpress.org blog support here. :)

  8. and the wordpress.com?

  9. Is for the blogs hosted here at wp.com. Please review the Please read me first sticky for more details. It's different software. We don't have access to adding in and using functions directly here.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags