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())

'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',

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

About lorddisk

WebCenter Content, WebCenter Portal, WebCenter Sites,Weblogic, Identity and Access Management (IAM),SSO,OAM,OIM,OAAM,OUD, OPAM,OID, OVD ,Oracle API Gateway ,OBIEE,OEDQ, Oracle ADF, Oracle SOA,J2EE, CackePHP ,PHP,J2SE,J2EE,Spring,Hibernate,JQuery,CSS,Java Script ,Joomla,Drupal,Worpress
This entry was posted in wordpress and tagged . Bookmark the permalink.

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 )

Google photo

You are commenting using your Google 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 )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.