Two Categories – Code

Here is the code for the page-2-categories.php main template:

<div class="two-categories">
<?php get_header(); ?>
 
<div id="main" class="row">
   
   <div id="content" class="col12">
      
      <div id="post-<?php the_ID(); ?>" <?php post_class('cf'); ?>>
 
         <h1>
            <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" rel="bookmark"><?php the_title(); ?></a>
            <?php bfa_comments_number(); ?>
         </h1>
         
         <div class="post-bodycopy cf">
            <?php the_content(); ?>
            <?php wp_link_pages( array( 
               'before' => __( '<p class="post-pagination">Pages:', 'montezuma' ), 
               'after' => '</p>'
            ) ); ?>
 
          
          </div>
 
         <?php edit_post_link( __( 'Edit', 'montezuma' ) ); ?>
 
      </div>
 
        <div class="half_width left_half">
         <h2>Category 1</h2>
         <?php bfa_custom_query(cat=2); ?>
             <?php bfa_loop( 'postformat' ); ?>
         </div>
 
        <div class="half_width right_half">
         <h2>Category 2</h2>
         <?php bfa_custom_query(cat=3); ?>
             <?php bfa_loop( 'postformat' ); ?>
         </div>

 
      <?php comments_template( '', true ); ?>
      
   </div>
   
</div>
 
<?php get_footer(); ?>
</div>

Here is the CSS:

.two-categories .half_width {
width: 47%;
display: inline-block;
float: left;
padding: 10px;
}
 
.two-categories .left_half {
margin-right: 5%;
}

Leave a Reply

Your email address will not be published. Required fields are marked *