Title: help with recent post from specific category PHP code
Last modified: August 20, 2016

---

# help with recent post from specific category PHP code

 *  [nikola_666](https://wordpress.org/support/users/nikola_666/)
 * (@nikola_666)
 * [14 years, 7 months ago](https://wordpress.org/support/topic/help-with-recent-post-from-specific-category-php-code/)
 * I need someone to modify this code to call a specific category name and show 
   posts from that specific category.
 * _[code moderated - see [http://codex.wordpress.org/Forum\_Welcome#Posting\_Code](http://codex.wordpress.org/Forum_Welcome#Posting_Code)]_

Viewing 4 replies - 1 through 4 (of 4 total)

 *  [nsathees](https://wordpress.org/support/users/nsathees/)
 * (@nsathees)
 * [14 years, 7 months ago](https://wordpress.org/support/topic/help-with-recent-post-from-specific-category-php-code/#post-2324854)
 * check this out
    [http://codex.wordpress.org/Function_Reference/in_category](http://codex.wordpress.org/Function_Reference/in_category)
 *  [amoon](https://wordpress.org/support/users/amoon/)
 * (@amoon)
 * [14 years, 7 months ago](https://wordpress.org/support/topic/help-with-recent-post-from-specific-category-php-code/#post-2324858)
 * <?php query_posts(‘cat=xx); ?>
    xx will be the category ID You can also use the
   category name or slug like this:
 * `<?php query_posts(‘category=category-slug-name’); ?>’
 * You can also use this to limit the number of posts on your homepage to be different
   from the number of posts shown on other pages as set in your blog Settings>Reading
   >blog pages show at most number of posts……
 * <?php query_posts(‘cat=8&showposts=4’); ?>
 *  Thread Starter [nikola_666](https://wordpress.org/support/users/nikola_666/)
 * (@nikola_666)
 * [14 years, 7 months ago](https://wordpress.org/support/topic/help-with-recent-post-from-specific-category-php-code/#post-2324868)
 * so I need to replace this `<?php if (is_category()) { ?>` with `<?php query_posts('
   category=category-slug-name'); ?>` or ?
 * Please if you can edit the whole code above ..
 *  [amoon](https://wordpress.org/support/users/amoon/)
 * (@amoon)
 * [14 years, 7 months ago](https://wordpress.org/support/topic/help-with-recent-post-from-specific-category-php-code/#post-2324879)
 * that should work

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘help with recent post from specific category PHP code’ is closed to new
replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 4 replies
 * 3 participants
 * Last reply from: [amoon](https://wordpress.org/support/users/amoon/)
 * Last activity: [14 years, 7 months ago](https://wordpress.org/support/topic/help-with-recent-post-from-specific-category-php-code/#post-2324879)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
