WordPress.org

Ready to get started?Download WordPress

Forums

2 columns of posts, each column is a different category (2 posts)

  1. el terrible bmw
    Member
    Posted 2 years ago #

    I have 2 columns and I want one category's posts in left column and another in the right. I want to have it on the homepage, but I want the pagination to work as well. What's the easiest way to do this? This is what I tried, but it screws up the pagination.

    <?php query_posts('cat=1&showposts=5'); ?>

    // all the code for a post here

    <?php query_posts('cat=2&showposts=5'); ?>

    // all the code for a post here

  2. el terrible bmw
    Member
    Posted 2 years ago #

    Ok so this is how I got it working.

    <div class="leftColumn">
    <?php query_posts("cat=1&showposts=5&paged=".$paged); while(have_posts()):the_post(); ?>
    
    // all the code for a post here
    
    <?php endwhile; ?>
    </div>
    
    <div class="rightColumn">
    <?php query_posts("cat=4&showposts=5&paged=".$paged); while(have_posts()):the_post(); ?>
    
    // all the code for a post here
    
    <?php endwhile; ?>
    </div>

    Now, how do I display the content for that page along with these posts?

    I tried this, but it screws up pagination.

    <h1><?php echo get_the_title(2); ?></h1>
        <?php
    	$my_id = 2;
    	$post_id_2 = get_post($my_id);
    	$content = $post_id_2->post_content;
    	$content = apply_filters('the_content', $content);
    	$content = str_replace(']]>', ']]>', $content);
    	echo $content;
    	?>
    	</div>

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.