• Is it possible to only have the excerpts displayed as links to the main text of each entry, instead of a whole page of complete text? I’ve just moved from moveable type and I love the WP interface. Very clean and efficient! The nice thing about MT was it didn’t display everything at the one time

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter stravaiger

    (@stravaiger)

    Thanks. Just looked at the template for index.php and changed it to get what I want:
    Where it displays the story content, put in an if check. On the front page the query string variable p isn’t defined. So you can use this to stop it displaying the content for each story.
    When you click on the link of the story title, p is defined.
    I’ve modified index.php to only display the title and excerpt:
    change:
    <div class=”storycontent”>
    <?php the_content(); ?>
    </div>
    to:
    <div class=”storycontent”>
    <?php if ($_GET[p] != “”) the_content(); else the_excerpt(); ?>
    </div>
    if the excerpt is empty, it displays the content for some reason. Probably something to do with the_excerpt()

    Isn’t that because you’ve put the IF statement? If the excerpt is empty, it says to show the whole comment.

    By default WP will return the content if there is no excerpt. Has nothing to do with the if statement and has everything to do with the way the_excerpt() works.
    TG

    Wow, this works effortlessly. Thank you for saving me from reformatting hundreds of posts from my old MT blog!

    There is a problem with this hack. When you use this hack, the pictures you posted will not show up. Can anybody help me solve this problem? Thanks!

    That’s cool, but how about a version that works with mod-rewrite rules turned on. ie; no query string…

    Here’s an implementation I’m currently running
    <div class="storycontent">
    <?php if (strlen(single_post_title("", false))>0){the_content();}else{the_excerpt();} ?>
    </div>

    If there is not a single post title and there is an excerpt, then it’ll just print the excerpt. In all other cases it will print the entire post.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Only display excerpt’ is closed to new replies.