Support » Fixing WordPress » Need one full article and the rest excerpts

  • kicker

    (@kicker)


    I need to have the newest article full and all the rest as excerpts.
    I found a little on this but it was from 2007 and it seems too complicated. There must be some simple way of doing this?
    Thanx
    Kicker

Viewing 7 replies - 1 through 7 (of 7 total)
  • alanchrishughes

    (@alanchrishughes)

    To pull the most recent article (full content).

    <?php query_posts('orderby=asc&posts_per_page=10' ); ?>
    
    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    
    <a>" rel="bookmark" class="title">
    <?php the_title(); ?>
    </a>
    <?php the_content(); ?>
    
    <?php endwhile; ?>
    <?php endif; ?>
    
    Then to pull 10 of the most recent posts with just excerpts
    
    <?php query_posts('orderby=asc&posts_per_page=10' ); ?>
    
    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    
    <a>" rel="bookmark" class="title">
    <div>
    <?php the_title(); ?>
    <?php the_excerpt(); ?>
    </div>
    </a>
    
    <?php endwhile; ?>
    <?php endif; ?>

    alanchrishughes

    (@alanchrishughes)

    For some reason its not letting me post this in the ‘code’ blocks.

    Michael

    (@alchymyth)

    Forum Moderator

    one possibility:

    <?php while( have_posts() ) : the_post(); //start of loop// ?>
    
    ...
    
    <?php
    if( $wp_query->current_post == 0 ) :
      the_content();
    else :
      the_excerpt();
    endif;
    ?>
    
    ...
    
    <?php endwhile; //end of loop// ?>
    kicker

    (@kicker)

    Cool and thanx. But where does that code go?

    What are code blocks?

    I thought this was built in to WP, but I guess it was built in to the last theme I used. A box that said something like HOW MANY FULL POSTS BEFORE EXCERPTS. That sure was easy! 🙂

    alanchrishughes

    (@alanchrishughes)

    Sorry, by code blocks I just meant on this messageboard, like the gray box alcyymyth got to work above there, and I think an admin must have fixed mine.

    The code will go in your index.php file, but if you aren’t really familiar with coding I wouldn’t suggest trying it yourself.

    kicker

    (@kicker)

    It all seems such a simple and useful option. Is there not a plugin for this kind of thing. I used HEADWAY as my last theme and it was part of that theme.

    alanchrishughes

    (@alanchrishughes)

    There are so many different needs and designs to meet those needs that it isn’t always useful.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Need one full article and the rest excerpts’ is closed to new replies.