wordpress

WordPress Recent Posts from specific category

here cat=1 is our category ID number and showposts=10 is our recent posts from specific category count. When you add this code to your sidebar.php file, you have to check your specific category ID from you admin panel, manage, categories.

global $post;
$recent = new WP_Query("cat=4&showposts=10");
while ($recent->have_posts())
{
$recent->the_post();

art_post_wrapper(
array(
'id' => art_get_post_id(),
'class' => art_get_post_class(),
//'thumbnail' => art_get_post_thumbnail(),
'title' => art_get_meta_option($post->ID, 'art_show_page_title') ? get_the_title() : '',
'before' => art_get_metadata_icons('edit', 'header'),
'content' => art_get_content(), // 'content' => 'My post content',
)
);
comments_template();

}
  print "<h2 class='art-postheader'>Latest News</h2>";
                    print "<ul>";
                     $recent = new WP_Query("cat=5&showposts=5");
                    while ($recent->have_posts())  
                {
                      $recent->the_post();
                            print "<li><a href=";
                            print the_permalink();
                            print " rel='bookmark'>";
                            print  the_title();
                            print   "</a></li>";
                      }
            
                            print "</ul>";


Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s