Wordpress - show messages of a certain category in the sidebar "recent messages"

How can I make the "latest posts" in the WP show sidebars only from a specific category?

+4
source share
2 answers

Probably the easiest way is to create your own recent message widget with one of the Otto php code widgets http://wordpress.org/extend/plugins/php-code-widget/ and a new request:

<?php $my_query = new WP_Query('category_name=mycategory&showposts=1'); ?> <?php while ($my_query->have_posts()) : $my_query->the_post(); ?> <a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"> <?php the_title(); ?></a> <?php endwhile; ?> 

Customize it the way you want. The new query loop will not conflict with the main WP loop and any amount of time can be used.

+5
source

Or, if you prefer something more user-friendly (does not require sending code to the widget), you can find the following plugin to use.

http://wordpress.org/extend/plugins/query-posts/

Nice little plugin written by Justin Tadlock.

+3
source

All Articles