WordPress.org

Ready to get started?Download WordPress

Forums

Category Page customization (2 posts)

  1. ajaykumarmeher
    Member
    Posted 1 year ago #

    I have 3 columns in my category page. On the left column, I want to show Recent posts only from that category I am viewing. In the middle column I want to show most viewed post only from that category and in the extreme right column I want o show all featured post.

    I am unable to accomplish that, so needing help.

  2. ajaykumarmeher
    Member
    Posted 1 year ago #

    Never mind...I found the solution... The below code did the trick

    <?php global $post; ?>
    			<?php $categories = get_the_category(); foreach ($categories as $category) :?>
    			<?php $args = array( 'numberposts' => 20, 'category' => $category->term_id ); ?>
    			<?php $myposts = get_posts( $args ); ?>
    
    			<?php foreach( $myposts as $post ) : setup_postdata($post); ?>
    
    ....................................

Topic Closed

This topic has been closed to new replies.

About this Topic