Title: help with modifying loop
Last modified: August 20, 2016

---

# help with modifying loop

 *  [cybershot](https://wordpress.org/support/users/cybershot/)
 * (@cybershot)
 * [14 years, 10 months ago](https://wordpress.org/support/topic/help-with-modifying-loop/)
 * I opened up loop.php because I want to exclude some categories from the blog.
   I have a static homepage and I created a blank blog page with a blog category.
   So all posts made that are for the blog will be posted under the blog category.
   In loop.php I added this code to the top of the loop
    `` <?php $options = get_option('
   option_tree'); //looping through my key to get the values foreach($options['exclude']
   as $cat) {
 *  //concatenating my values into one string
    $string .= '-' .$cat.","; }
 * //trimming the trailing comma from the string
    $string = substr($string, 0, -
   1); // Delete the last character
 *  query_posts( 'cat=' . $string . '&paged=' . $paged);
    ?>
 * <?php while ( have_posts() ) : the_post(); ?>//the loop continues as normal
 * ‘
 * the code does work as all the categories did disapear from the blog page. My 
   only issue is that the first default wordpress code that is in the uncategorized
   section got duplicated for some reason and shows up twice. Now yes, I could just
   easily hide this category, but I would like my code to be 100% correct without
   any cheating. Anyone got any idea what I am doing wrong?

The topic ‘help with modifying loop’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 0 replies
 * 1 participant
 * Last reply from: [cybershot](https://wordpress.org/support/users/cybershot/)
 * Last activity: [14 years, 10 months ago](https://wordpress.org/support/topic/help-with-modifying-loop/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
