WordPress.org

Ready to get started?Download WordPress

Forums

Montezuma
How to display posts from a specific category in two columns? (4 posts)

  1. FoMurJIom
    Member
    Posted 3 months ago #

    How to display posts from a specific category in two columns?
    Help please

  2. CrouchingBruin
    Member
    Posted 3 months ago #

    So not all category pages, but just one specific category?

    Let's say, for example, that you have a category called Dogs, and the slug name is dogs. You can try adding this to the end of your various.css virtual file:

    .hentry.category-dogs {
       width: 45%;
       margin-right: 5%;
       float: left;
    }
    
    body.category-dogs .post-list .hentry:nth-of-type(odd) {
       clear: both;
    }

    What the first rule does is set the width of the posts to 50% (45% actually, but with a 5% margin so there's spacing between the two columns).

    The second rule clears the odd numbered posts (1, 3, 5, etc) from the posts before it, so that posts will appear side-by-side. Otherwise, you'll get posts filling up the empty spaces and it won't be uniform.

  3. FoMurJIom
    Member
    Posted 3 months ago #

    Thanks for the help, but I found a solution to your problem

    <!--<div id="container">-->
    <?php get_header(); ?>
    <div id="main" class="row">
    	<div id="content" class="cf col3">
    		<?php bfa_custom_query('cat=9&posts_per_page=5&caller_get_posts=1'); ?>
    		<?php bfa_content_nav( 'multinav1' ); ?>
    		<?php bfa_loop( 'myotherformat' ); ?>
    		<?php bfa_content_nav( 'multinav2' ); ?>
    	</div>
    	<div id="content" class="cf col3">
    		<?php bfa_custom_query('cat=13&posts_per_page=5&caller_get_posts=1'); ?>
    		<?php bfa_content_nav( 'multinav1' ); ?>
    		<?php bfa_loop( 'myotherformat' ); ?>
    		<?php bfa_content_nav( 'multinav2' ); ?>
    	</div>
     	<div id="content" class="cf col3">
    		<?php bfa_custom_query('cat=12&posts_per_page=5&caller_get_posts=1'); ?>
    		<?php bfa_content_nav( 'multinav1' ); ?>
    		<?php bfa_loop( 'myotherformat' ); ?>
    		<?php bfa_content_nav( 'multinav2' ); ?>
    	</div>
    	<div id="widgetarea-one" class="col3">
    		<?php dynamic_sidebar( 'Widget Area ONE' ); ?>
    	</div>
    </div>
    <?php get_footer(); ?>
    <!--</div>-->
  4. CrouchingBruin
    Member
    Posted 3 months ago #

    That's awesome! I didn't notice that the latest release, 1.2.2, has two new functions, bfa_custom_query and bfa_get_template_part. I'm going to have to check them out. It sounds like bfa_custom_query has the same functionality of a plugin that I've been using. Thanks for the example.

Reply

You must log in to post.

About this Theme

About this Topic

Tags

No tags yet.