WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. yes_in
    Member
    Posted 4 months ago #

    HI,
    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
    Member
    Posted 1 month 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; ?>
    <ul>
    <?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>`

Reply

You must log in to post.

About this Topic