WordPress.org

Ready to get started?Download WordPress

Forums

Benevolence theme - not showing excerpts (10 posts)

  1. allpedal
    Member
    Posted 8 years ago #

    index.php is used for both the front page and page itself. If I change the <?php the_content(); ?> to the_excerpt it just shows the excerpt on both pages

    How can I show the excerpt on the main page and full article on the page itself if they are both using the same index.php?

    thanks

  2. Lorelle
    Member
    Posted 8 years ago #

    It's the magic of PHP and WordPress. It knows the difference. Have you tried it?

  3. allpedal
    Member
    Posted 8 years ago #

    well I'm not sure what you mean here - I tried both excerpt and content statements if thats what you mean or are you just bored?

  4. Mark (podz)
    Support Maven
    Posted 8 years ago #

    You want the excerpt and the main content ?

    If you mean just show a few lines then have a (more......) to click, use the quicktag 'more' button and place the <---more---> where you want the break to appear.
    If I've got that wrong, if you could explain again it would help.

  5. Mark (podz)
    Support Maven
    Posted 8 years ago #

    Ohh.......sorry ...

    Copy index.php
    Rename it to 'page.php'
    in 'page.php' use the_content

  6. allpedal
    Member
    Posted 8 years ago #

    I only want the excerpt to show. If I rename it to page.php how do I get the index to go to page.php?

    thanks for the help

  7. Lorelle
    Member
    Posted 8 years ago #

    Okay, let's clear a few things up. For extensive information on how to use the <!--more--> see: Linking_Posts_Pages_and_Categories.

    When used with the_content() template tag, where you put the MORE tag (from the Quicktags above the Write Post textarea where you write your post), an excerpt will be show to that point.

    If you use the_excerpt() instead of the_content(), the first 120 words of the post will be show automatically or whatever you have entered in your explicit excerpt text area on the Write Post panel.

    Both methods will show the excerpt on the front page and when you click the title, it will show the full post on the single post page, whether or not you are using the index.php to generate both page views. The view of the page is based upon The Loop not the template tag you use within it.

    If you are trying to generate a specific look for the single post view, then you can use a template called single.php as discussed in Stepping Into Templates.

    Podz mentioned using the page.php template which is used for generating Pages in WordPress not single post web pages.

  8. skeltoac
    Member
    Posted 8 years ago #

    allpedal: Please supply a link to your blog and a link to the theme so I can check out the source you're working with. If I understand you correctly, there isn't a "single.php" in the theme. Is that true? If so, do this:

    <?php if (is_single()) the_content(); else the_excerpt(); ?>

  9. Mark (podz)
    Support Maven
    Posted 8 years ago #

    We are at cross purposes I think...

    You keep index.php, and in that file, you use the_excerpt.

    In page.php, you have the_content

    BUT

    page.php only works for pages - not single post views. In that case , you need to do something different. Before I head off in that direction, do you want this for Posts, or Pages ?

  10. allpedal
    Member
    Posted 8 years ago #

    Lorelle, the Benevolence theme isn't using single or page.php so when I changed from the_content to the_excerpt it showed the excerpt for both the index and page.

    What skeltoac said to do worked perfectly and thanks very much for the quick fix.

    Thank you all for the speedy help.

Topic Closed

This topic has been closed to new replies.

About this Topic