Forums

First blog post no excerpt (10 posts)

  1. camilstaps
    Member
    Posted 4 months ago #

    Hi there,

    I would like to have a setting / plugin that could do the following to my blog: On my front page (www.camilstaps.nl), some new and fresh posts are listed. All are displayed as excerpts. Now I would like to see that the first one is a full post, but every older post is displayed as an excerpt.

    How can I make such thing? Which setting / plugin do I have to use?

    Thanks in advance!

    Camil Staps

  2. esmi
    Theme Diva & Forum Moderator
    Posted 4 months ago #

    You would need to start editing the Loop in your current theme's index.php template file.

  3. alchymyth
    The Sweeper
    Posted 4 months ago #

    start editing the Loop in your current theme's index.php template file

    for instance, replace
    the_excerpt()
    with
    if($wp_query->current_post == 0 && !is_paged()) { the_content(); } else { the_excerpt(); }

    see also my recent post.

  4. camilstaps
    Member
    Posted 4 months ago #

    Thanks for the help. But, I'm using theme twenty eleven. In that index.php they use the_blog() instead of the_content(). How should I change the file now?

    Camil

  5. esmi
    Theme Diva & Forum Moderator
    Posted 4 months ago #

    1. Twenty Eleven does not use blog(). It uses the_excerpt() & the_content().

    2. Do not edit the Twenty Eleven theme. It is the default WordPress theme and having access to an unedited version of the theme is vital when dealing with a range of site issues. Create a child theme for your changes.

  6. camilstaps
    Member
    Posted 4 months ago #

    Thanks for tip 2.
    1: see http://phpxref.ftwr.co.uk/wordpress/nav.html?wp-content/themes/twentyeleven/index.php.source.html line 25. That's the line you mean, right? Or is it somewhere else I need some changes?

  7. esmi
    Theme Diva & Forum Moderator
    Posted 4 months ago #

    No - you'd need a customised version of content.php in your child theme.

  8. camilstaps
    Member
    Posted 4 months ago #

    I can't follow you anymore. Could you please say what I have to do? I have a child theme of a fresh installed twenty eleven theme. Now which files do I have to add in the child theme and how do I have to edit them?

  9. alchymyth
    The Sweeper
    Posted 4 months ago #

    to clarify: you seem to be using the 'more-tag' in your posts to shorten the output on the front page;
    therefore it is not a problem of replacing 'the_excerpt', instead read:

    http://codex.wordpress.org/Customizing_the_Read_More#More_about_.24more

    together with my earlier suggestion, applied to a child of Twenty Eleven:

    copy content.php into the child theme; edit here:

    <?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyeleven' ) ); ?>

    change into:

    <?php global $more; if($wp_query->current_post == 0 && !is_paged()) { $more = -1; }
    the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyeleven' ) );
    $more = 0; ?>
  10. camilstaps
    Member
    Posted 4 months ago #

    Thanks. This works.

Reply

You must log in to post.

About this Topic