WordPress.org

Support

Support » Plugins and Hacks » Front page – Excerpt

Front page – Excerpt

  • :: originally posted in feedback – perhaps more appropriate here.

    Is it possible to publish just post Title and Excerpt on front page instead of the full body of the text?

    By clicking on Title – the user can check the full text for the post.

    Can this presently be done or would it require some php tweakery?

    Thanks,

    Al

Viewing 15 replies - 1 through 15 (of 24 total)
  • Yep. Yep and yep (on the tweakery — nut not much).

    http://wordpress.org/support/topic.php?id=20906#post-119139

    Just tried that (wordpress 1.5)

    Found: <?php the_content(); ?> in wp.php and changed it to:

    <?php if($single) { ?>
    <?php the_content(); ?>
    <?php } else { ?>
    <?php the_excerpt(); ?>
    <?php } ?>

    Wrote the article in advanced editing with an excerpt and it still displays the full story!

    For 1.5 you could also try:

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

    you’re a star !
    I made the edit in index.php – works!
    Thanks

    I followed the suggestion here to successfully end up with a front page that publishes excerpts … but not the way I was hoping it would.

    I would like full entries to appear on the homepage for all entries for which the excerpt block was left blank, and for excerpts to appear only for entries for which an excerpt was entered during post creation. Seems like this should be the default function … but, instead, I now have excerpts only for ALL entries.

    Help?

    If the posthas an excerpt display the excerpt, else display the content.

    Something like the following should work:

    <?php if($post->post_excerpt) :
    the_excerpt();
    else:
    the_content();
    endif;
    ?>

    or as a one-liner:
    <?php ($post->post_excerpt) ? the_excerpt() : the_content(); ?>

    Thanks, TDW. That’s great.
    Any idea how/where I can add something that’ll place at the end of the excerpt a link to the full entry?

    I answered my own question … sorta.

    This gives me a link to the full entry that follows the excerpt:
    <?php if($post->post_excerpt) :
    the_excerpt(); ?><a href="<?php the_permalink() ?>" rel="bookmark" title="Read the rest of <?php the_title(); ?>">Read the rest-></a>
    <?php else:
    the_content();
    endif;
    ?>

    However, it places said link on its own line, with a break between the excerpt and the link. Any idea how to get the link to remain inline with the final line of the excerpt itself?

    I’m not sure if this helps, but do you have the <!--more--> placed in your post with a line above it or on the line that you want the excerpt to end?

    If you aren’t using the “more” quick tag, and using an actual excerpt, check to see if there is a line break at the end of the excerpt.

    That might be the problem.

    Not using a <!–more–> tag; I hacked in a “Read the rest” link.
    No line break at the end of excerpt.

    the_excerpt() comes back already filtered so to get your link appearing in the same paragraph you need to format the excerpt yourself:

    <?php if($post->post_excerpt) :
    $output = $post->post_excerpt();
    $output .= ' <a href="'.get_permalink().'" rel="bookmark" title="Read the rest of '.the_title().'">Read the rest-></a>';
    echo apply_filters('the_excerpt',$output);
    else:
    the_content();
    endif;
    ?>

    just two things.
    first, I think
    $output = $post->post_excerpt();
    should look like
    $output = $post->post_excerpt;

    second, the title="Read the rest of '.the_title().'" part seems to be causing some problems. The post title appears again as part of the post content. Removing the call to the_title( ) solves the problem. I’m not sure why this is though. Is it a bug in apply_filters?

    Change

    the_title()

    to

    the_title("","",false)

    thank you.

    I have permalink turned on, and I think it causes the excerpt to display even if I am looking at a particular post. None of the example above work for my WP1.5.

    I always see the_excerpt(); and never the_content();. Even if I click on one post.

    http://www.isp-blog.com

    Help

Viewing 15 replies - 1 through 15 (of 24 total)
  • The topic ‘Front page – Excerpt’ is closed to new replies.