• I love the look of the recent posts widget in my sidebar, but I also need a way to display the latest posts from a specific category. I didn’t see a way to do this with your widgets or the standard widgets, so I added the plugin Flexible Posts Widget. It works, but doesn’t display nearly as nicely. I would much prefer to do this through one of your widgets as it was decided for this theme.

    Any way to do that?

    You can see the Flexible Posts Widget at the bottom of the sidebar on this page:
    http://www.archcityhomes.com/local-info/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi, you can use Moesia: Recent Posts and change theme folder > widgets > recent-posts.php, this line:

    $r = new WP_Query( apply_filters( 'widget_posts_args', array(
    			'posts_per_page'      => $number,
    			'no_found_rows'       => true,
    			'post_status'         => 'publish',
    			'ignore_sticky_posts' => true,
    		) ) );

    to this:

    $r = new WP_Query( apply_filters( 'widget_posts_args', array(
    			'posts_per_page'      => $number,
    			'no_found_rows'       => true,
    			'post_status'         => 'publish',
    			'ignore_sticky_posts' => true,
    			'category_name'		=> 'landscapes, uncategorized'
    		) ) );

    This is what is added just specify your categories separated by comma or specify just one category.
    'category_name' => 'landscapes, uncategorized'

    Also consider using child theme since changes will be lost on next theme update.

    Best regards

    Thread Starter karenstl

    (@karenstl)

    Is there a way to do this with css? I don’t use a child theme and try not to modify theme files.

    Hi, no it is not possible, css is only for styling.

    Best regards

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Sidebar Widget – recent posts from just one category’ is closed to new replies.