Mullet code for WordPress

Hey, below is the blog mulletization code for WordPress powered weblogs. It’s damn easy. Have fun!


<?php 
  // to count posts inside WP loop
  $postCount=0; 
  // number of full posts to display
  $displayNumPosts = 5; 
?>
<?php
  // WP loop
  if(have_posts()) : while (have_posts()) : the_post(); 
?>
    <?php
      if($postCount<$displayNumPosts) {     
    ?>        
        <!-- TEMPLATE CODE TO SHOW FULL POST -->
        <a href="<?php the_permalink() ?>">
        <?php the_title(); ?>
        </a>
        <div class="content">
        <?php the_content(); ?>
        </div>    
    <?php } else { ?>
        <!-- TEMPLATE CODE TO SHOW MULLETED POST -->
        <?php the_time('M j, y') ?> 
        <a href="<?php the_permalink() ?>">
        <?php the_title(); ?>
        </a>        
    <?php } ?>    
    <?php     
      // increment $postCount
      $postCount++;   
    ?>
<?php
  // WP loop ends
  endwhile; endif;
?>

14 thoughts on “Mullet code for WordPress

  1. Hi Kapil,

    I do want to use your code, but I had a question. I see no way as to where you are checking for a total number of posts? I mean how do you know in this loop when to stop?

    Say I want a total of 5 + 30 posts in the mullet?

  2. Hey Hemanshu,

    Right now it is showing up all the posts. It uses a while loop to do so:

    // WP loop
    if(have_posts()) : while (have_posts()) : the_post();

Leave a comment