Title: brownca's Replies | WordPress.org

---

# brownca

  [  ](https://wordpress.org/support/users/brownca/)

 *   [Profile](https://wordpress.org/support/users/brownca/)
 *   [Topics Started](https://wordpress.org/support/users/brownca/topics/)
 *   [Replies Created](https://wordpress.org/support/users/brownca/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/brownca/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/brownca/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/brownca/engagements/)
 *   [Favorites](https://wordpress.org/support/users/brownca/favorites/)

 Search replies:

## Forum Replies Created

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

 *   Forum: [Themes and Templates](https://wordpress.org/support/forum/themes-and-templates/)
   
   In reply to: [[nano blogger] Change to only 1 widget area](https://wordpress.org/support/topic/change-to-only-1-widget-area/)
 *  Thread Starter [brownca](https://wordpress.org/support/users/brownca/)
 * (@brownca)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/change-to-only-1-widget-area/#post-4367540)
 * Ok i figured this out myself. I created a child theme and added a file called
   style.css with the code
 *     ```
       /*
        Theme Name:     Nano Blogger Child
        Template:       nano-blogger
        Version:        1.0.0
       */
   
       @import url("../nano-blogger/style.css");
   
       /* =Theme customisation starts here
       -------------------------------------------------------------- */
       #container {
       	width: 780px;
       	}
       ```
   
 * and a file called functions.php with the code
 *     ```
       <?php
   
       function remove_some_widgets(){
   
       	unregister_sidebar( 'primary_widget_area' );
       	//unregister_sidebar( 'secondary_widget_area' );
       }
       add_action( 'init', 'remove_some_widgets', 11 );
   
       ?>
       ```
   
 * and that’s worked.
 *   Forum: [Themes and Templates](https://wordpress.org/support/forum/themes-and-templates/)
   
   In reply to: [Problems with using variables in php](https://wordpress.org/support/topic/problems-with-using-variables-in-php/)
 *  Thread Starter [brownca](https://wordpress.org/support/users/brownca/)
 * (@brownca)
 * [16 years, 8 months ago](https://wordpress.org/support/topic/problems-with-using-variables-in-php/#post-1235742)
 * Brilliant. Thanks very much, I’ll download a proper editor now to avoid mistakes
   like these in the future. Many thanks.
 *   Forum: [Themes and Templates](https://wordpress.org/support/forum/themes-and-templates/)
   
   In reply to: [Problems with using variables in php](https://wordpress.org/support/topic/problems-with-using-variables-in-php/)
 *  Thread Starter [brownca](https://wordpress.org/support/users/brownca/)
 * (@brownca)
 * [16 years, 8 months ago](https://wordpress.org/support/topic/problems-with-using-variables-in-php/#post-1235726)
 * Well, I’ve found a workaround for now by using an If statement for every single
   category, which makes for tons more code but it gets the job done. If anyone 
   knows what I was doing wrong before with the variable I’d love to know.
 * Thanks for your help MichaelH 🙂
 *   Forum: [Themes and Templates](https://wordpress.org/support/forum/themes-and-templates/)
   
   In reply to: [Problems with using variables in php](https://wordpress.org/support/topic/problems-with-using-variables-in-php/)
 *  Thread Starter [brownca](https://wordpress.org/support/users/brownca/)
 * (@brownca)
 * [16 years, 8 months ago](https://wordpress.org/support/topic/problems-with-using-variables-in-php/#post-1235646)
 * That part of the code isn’t the problem. I’ve already successfully stored the
   parent category ID, which I know because I checked with:
    `<?php echo $parent_id;?
   >` When I’m viewing a post with category parent id 3, I will see the number 3
   in the sidebar, so I know the variable should contain the number 3.
 * The problem is this line:
    `$my_query = new WP_Query('cat=$parent_id&order=desc&
   showposts=7'); ?>` specifically the **cat=$parent_id** part. This doesn’t seem
   to be looking inside the variable $parent_id for the number 3, because it just
   returns posts from all categories. When I replace $parent_id with the number 
   3, the code works. But it shouldn’t make any difference, if you see what I mean?
 *   Forum: [Themes and Templates](https://wordpress.org/support/forum/themes-and-templates/)
   
   In reply to: [Problems with using variables in php](https://wordpress.org/support/topic/problems-with-using-variables-in-php/)
 *  Thread Starter [brownca](https://wordpress.org/support/users/brownca/)
 * (@brownca)
 * [16 years, 8 months ago](https://wordpress.org/support/topic/problems-with-using-variables-in-php/#post-1235526)
 * That doesn’t make any difference – the only difference that should make is getting
   the category id instead of the parent category id. Unfortunately it does neither,
   and just returns all posts regardless of category.
 * I’m pretty sure it’s something to do with using a $variable in line 9 of my code
   above, since if I replace the variable after ” ‘cat= ” with a number of a category,
   the code works fine.
 * I just don’t know why it won’t work with a variable containing a value, but it
   will work with the value on its own.

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