widgets can filter recent post from one category (2 posts)

  1. yes_in
    Posted 2 years ago #

    I want to include recent post only from one category , but it's not working I've tried many plug-ins but none of theme have worked I think the is a problem with my code
    I tried Most recent posts and Special Recent posts,
    how can I make this work?

  2. Shahriar Ahmed
    Posted 2 years ago #

    Edit - Category_name
    Edit - showposts=3

    ` <h3><?php _e('Recent Post by Category','cover-wp') ?></h3>
    <?php query_posts("showposts=3&category_name=Category_name"); $i = 1; ?>
    <?php if(have_posts()) : while(have_posts()) : the_post(); ?>
    <li><a href="<?php echo the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></li>
    <?php endwhile; ?>
    <?php else: ?>
    <p><?php _e('No Recent Posts by Category','cover-wp') ?></p>
    <p><?php _e('Show your Recent Posts by Category Rename Category.','cover-wp') ?></p>`

Topic Closed

This topic has been closed to new replies.

About this Topic