Posterous
codebox is using Posterous to post everything online. Shouldn't you?
Netlexlogo_thumb
 
Netlex’s codebox - tools and tips for web amateurs
« Back to blog

WP : loop full article + excerpt


<?php if (have_posts()) : ?>
    <?php $count = 0; ?>

   

    <?php while (have_posts()) : the_post(); ?>
        <?php $count++; ?>

       
        <h3>Title: </h3>
        <h4>Date: <?php echo date("l, F d, Y"); ?> | <?php comments_number(); ?></h4>

        <?php if ($count == 1) : ?>

            <?php the_content(); ?> // display the full content of the first post only

            <h4>Please subscribe to my feed!</h4>

        <?php else : ?>

           
            <?php the_excerpt(); ?> // display only the excerpt for all other posts

            // for all posts except the first, process this code below each post

        <?php endif; ?>

        // for each post, including the first, process any code included here
        // any code output will be displayed below the content of every post

                        <h4>This is post #<?php the_ID(); ?> | Author: <?php the_author(); ?></h4>
        <p>Filed under: <?php the_category(','); ?> | <?php edit_post_link(); ?></p>

    <?php endwhile; ?>

    // stop the post loop and process any code included here only once
    // any code output will be displayed below the entire set of posts

                <h4><?php posts_nav_link() ?><?php previous_post_link(); ?> &#8226;
        <?php posts_nav_link() ?><?php next_post_link(); ?></h4>

    <?php else : ?>

    // if there are no posts to display, process any code that is included here
    // the output of any code included here will be displayed instead of posts

              <p>Sorry, no posts matched your criteria.</p>

<?php endif; ?>

// any code included here occurs after the wordpress loop and is always displayed
<h6>Copyright &copy; <?php echo get_settings('home'); ?>/"><?php bloginfo('name'); ?></a> <?php echo date('Y'); ?></h6>

 
To leave a comment on this posterous, please login by clicking one of the following.
Posterous-login     Connect     twitter