Title: Magazine Basic by Category
Last modified: August 21, 2016

---

# Magazine Basic by Category

 *  [awhill00](https://wordpress.org/support/users/awhill00/)
 * (@awhill00)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/magazibe-basic-by-category/)
 * I love the default way that WordPress displays the initial featured image a bit
   larger at the top of the page and then displays three horizontal columns beneath
   it. But how can I tweak the code in the php file to query and return only a particular
   category on the front page instead of recent posts? I want to use some sort of
   code like this…
 * <?php
    query_posts(‘showposts=4&cat=3’); while(have_posts())…; ?>
 * Thanks

Viewing 1 replies (of 1 total)

 *  Thread Starter [awhill00](https://wordpress.org/support/users/awhill00/)
 * (@awhill00)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/magazibe-basic-by-category/#post-4778774)
 * Found it…
 * Place this code in functions.php to cause the home page to display posts only
   from one category. Category is ‘123’ in example below. Works great!
 * function my_home_category( $query ) {
    if ( $query->is_home() && $query->is_main_query()){
   $query->set( ‘cat’, ‘123’ ); } } add_action( ‘pre_get_posts’, ‘my_home_category’);

Viewing 1 replies (of 1 total)

The topic ‘Magazine Basic by Category’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 1 participant
 * Last reply from: [awhill00](https://wordpress.org/support/users/awhill00/)
 * Last activity: [12 years, 1 month ago](https://wordpress.org/support/topic/magazibe-basic-by-category/#post-4778774)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
