Title: integrate this loop code
Last modified: August 18, 2016

---

# integrate this loop code

 *  [Marcomail](https://wordpress.org/support/users/marcomail/)
 * (@marcomail)
 * [19 years, 11 months ago](https://wordpress.org/support/topic/integrate-this-loop-code/)
 * In index.php i have modify the loop code, but i think in index.php it’s not necessary
   specific if (is_home()) because it’s always the main page, how can i integrate
   this two code in one ?
 * <?php
    if (is_home()) { query_posts(‘cat=1,2,3,4,5,7,9’); } ?>
 * <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

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

 *  Thread Starter [Marcomail](https://wordpress.org/support/users/marcomail/)
 * (@marcomail)
 * [19 years, 11 months ago](https://wordpress.org/support/topic/integrate-this-loop-code/#post-399621)
 * Or do you have the best way to exclude two categories from the main page ?
 *  Moderator [Samuel Wood (Otto)](https://wordpress.org/support/users/otto42/)
 * (@otto42)
 * WordPress.org Admin
 * [19 years, 11 months ago](https://wordpress.org/support/topic/integrate-this-loop-code/#post-399623)
 * I use the CategoryVisibility-rh plugin for this sort of thing: [http://ryowebsite.com/?p=46](http://ryowebsite.com/?p=46)
 * Very easy to use and configure, no need to edit any theme code.
 *  Thread Starter [Marcomail](https://wordpress.org/support/users/marcomail/)
 * (@marcomail)
 * [19 years, 11 months ago](https://wordpress.org/support/topic/integrate-this-loop-code/#post-399629)
 * I wouldn’t use the category-visibily plugin, i want understand how can integrate
   this code in two line:
 * <?php if (have_posts()) : while (have_posts()) : the_post();
    query_posts(‘cat
   =1,2,3,4,5,7,9’); ?>
 * Is it correct ?

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

The topic ‘integrate this loop code’ is closed to new replies.

 * 3 replies
 * 2 participants
 * Last reply from: [Marcomail](https://wordpress.org/support/users/marcomail/)
 * Last activity: [19 years, 11 months ago](https://wordpress.org/support/topic/integrate-this-loop-code/#post-399629)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
