Home / posts / Posts in two columns
  • How to Posts in two columns

    no thumbnail sorry: Posts in two columns

    Adding this PHP code to your wordpress theme will split your posts into two columns.

    ( click code to copy )

    wordpress snippet : PHP

    <>
         <div class="box"><?php query_posts('showposts=4'); ?><?php $hol = 1; ?>
         <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
         <?php if (in_category('3')) continue; ?>
         <?php if (in_category('4')) continue; ?>
         <?php if ($hol == 1) echo "<div class=\"row\">"; ?>
         <div class="post hol<?php echo $hol;?>" id="post-<?php the_ID(); ?>">
         <?php if ( get_post_meta($post->ID, 'thumb', true) ) { ?>
         <?php } else { ?>
         <?php } ?>
    <h2><a title="Permanent Link to <?php the_title(); ?>" href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h2>
            <p><?php the_excerpt(); ?></p>
           <?php if ($hol == 1) echo "</div>";
            (($hol==1) ? $hol=2 : $hol=1); ?>
          </div><!--/post-->
       <?php endwhile; ?>
    <?php endif; ?>
    

    ( WordPress codex functions, hooks, in this snippet. )

    the_excerpt, the_title, the_permalink, query, get_post, have_posts, the_ID, the_post, get_post_meta, in_category, _e, _ex, query_posts, wp,