• Christopher Roberts

    (@christopherrobertswordpress)


    Hi everyone, I am a member of the admin team for a community blog called Technology Bloggers and was wondering how I would go about changing the way posts are displayed on the homepage, page 2, 3 etc.

    I want the first two posts to show in full on the homepage.

    I would then like to show the titles of posts, followed by the first say 500 characters of the post, and then a link where people can carry on reading the post – much like how Ari does it on his blog: http://ariherzog.com/

    Any ideas on the sort of code I would need to do this?

    Thanks 🙂
    Christopher

Viewing 9 replies - 1 through 9 (of 9 total)
  • general:

    edit loop.php, locate the second occurrence of:

    <?php if ( is_archive() || is_search() ) : // Only display excerpts for archives and search. ?>

    change it to:

    <?php if ( is_archive() || is_search() || is_paged() || $wp_query->current_post >= 2 ) : // Only display excerpts for archives and search. ?>

    if you need to exclude other sections, you could use:

    <?php if( $wp_query->current_post < 2 && !is_paged() ) : ?>
    STUFF TO SHOW ONLY FOR FIRST TWO POSTS ON FRONT
    <?php endif; ?>

    to adjust the length of the excerpts, change the number here in functions.php:

    function twentyten_excerpt_length( $length ) {
    	return 40;
    }
    add_filter( 'excerpt_length', 'twentyten_excerpt_length' );
    Thread Starter Christopher Roberts

    (@christopherrobertswordpress)

    Okay, I have replaced

    <?php if ( is_archive() || is_search() ) : // Only display excerpts for archives and search. ?>

    in the loop with

    <?php if ( is_archive() || is_search() || is_paged() || $wp_query->current_post >= 2 ) : // Only display excerpts for archives and search. ?>

    but nothing seems to have happened – I am doing this on a test site, not the actual blog.

    What code do I need to add to the homepage/page2 for it to work?

    We currently use the page home.php for the home, not index.php, as we had to create this page to allow use to show only 3 posts on homepage, and then more on pages after that.

    Thanks for your help.

    We currently use the page home.php for the home

    what is the code of that template?

    http://codex.wordpress.org/Forum_Welcome#Posting_Code

    Thread Starter Christopher Roberts

    (@christopherrobertswordpress)

    home.php
    http://pastebin.com/BiUCWb4T

    index.php
    http://pastebin.com/mpY8s7tm

    functions.php
    http://pastebin.com/7MSUkBmH

    need any more?

    Thanks for your help

    does your theme have a loop-home.php template?

    if not, then loop.php will do the job, and my suggestion should in principle have worked;

    this line appears twice in loop.php:
    <?php if ( is_archive() || is_search() ) : // Only display excerpts for archives and search. ?>
    did you edit the one which appears closest to the end of the template?

    Thread Starter Christopher Roberts

    (@christopherrobertswordpress)

    Loop home
    http://pastebin.com/p7jbWrxa

    this line appears twice in loop.php:
    <?php if ( is_archive() || is_search() ) : // Only display excerpts for archives and search. ?>
    did you edit the one which appears closest to the end of the template?

    – yeah :-/

    with your structure having a home.php, did you make the suggested edits in loop-home.php (in line 132) ?

    Thread Starter Christopher Roberts

    (@christopherrobertswordpress)

    Working thanks 🙂

    A few things I would like to modify if possible
    1) it shows the excerpt, can we get it to show the first say 500 characters of the post instead?
    2) how can I remove the tags and categories below these posts? (page2,3,4 etc. only, not category, tag and author archives)

    1) there might be plugins; or this has posssibly been answered before in the forum – forum search?

    2)
    I already suggested the initial approach with a conditional statement around these codes –
    to remove those postmetadata on all those excerpts of the front page and its follow pages:

    before this line:
    <div class="entry-utility">
    add:
    <?php if( !is_home() || is_home() && $wp_query->current_post < 2 && !is_paged() ) : ?>

    then, after this line:
    </div><!-- .entry-utility -->
    add:
    <?php endif; ?>

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Page design to show summary of posts’ is closed to new replies.