Title: Custom sidebar code
Last modified: August 20, 2016

---

# Custom sidebar code

 *  Resolved [GrayDuck](https://wordpress.org/support/users/grayduck/)
 * (@grayduck)
 * [14 years, 7 months ago](https://wordpress.org/support/topic/custom-sidebar-code/)
 * I’m relatively new to WordPress (someone has called me into update a preexisting
   site) I’m learning as I go, so please bear with me!
 * The site I’m updating uses a custom sidebar, and that is where we’re wanting 
   a “subscribe via email” box to appear. I installed subscribe2 and the Subscribe2
   widget. I followed the directions and setup a widget on “sidebar 1” (it’s the
   only widget on there). And nothing appeared on the site.
 * I think I’ve figured out that that’s because we’re not using “sidebar 1” – it’s
   pulling from sidebar.php. What I (think) I’d like to do is find the widget code
   and copy / paste it into sidebar.php but I can’t find it or “sidebar 1” anywhere!
 * Can someone point me in the right direction? Or if there’s a better way to go
   about setting up email subscriptions, I’m all ears!

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

 *  [orpatech](https://wordpress.org/support/users/orpatech/)
 * (@orpatech)
 * [14 years, 7 months ago](https://wordpress.org/support/topic/custom-sidebar-code/#post-2375176)
 * Try another plugin…
    Wp-Autoresponder
 *  [Matt Robinson](https://wordpress.org/support/users/mattyrob/)
 * (@mattyrob)
 * [14 years, 7 months ago](https://wordpress.org/support/topic/custom-sidebar-code/#post-2375181)
 * [@grayduck](https://wordpress.org/support/users/grayduck/),
 * You could place the widget manually or Widget enable your theme.
 * To manually place it read [here](http://subscribe2.wordpress.com/2006/09/19/sidebar-without-a-widget/).
 *  Thread Starter [GrayDuck](https://wordpress.org/support/users/grayduck/)
 * (@grayduck)
 * [14 years, 7 months ago](https://wordpress.org/support/topic/custom-sidebar-code/#post-2375271)
 * Thanks MattyRob… I’m half way there!
 * I’m stuck and my problem was addressed [here](http://wordpress.stackexchange.com/questions/12971/problem-with-implementing-widget-via-the-content).
   It looks like the solution to my problem is below:
 * > I had to figure this one out, since I’ve actually wondered for a while how 
   > to remove a filter that was passed by reference. In this case the class MnglAppController
   > which adds the filter is initiated as a variable:
   > `$mngl_app_controller = new MnglAppController();`
   >  So to remove it, you have
   > to globalize that variable, and pass it as part of the remove_filter call:
   >     ```
   >     global $mngl_app_controller;
   >     remove_filter( 'the_content', array($mngl_app_controller, 'page_route'), 100 );
   >     $content = apply_filters('the_content', '<!--subscribe2-->');
   >     echo $content;
   >     add_filter( 'the_content', array($mngl_app_controller, 'page_route'), 100 );
   >     ```
   > 
 * But I don’t know where to put:
    `$mngl_app_controller = new MnglAppController();`
   As it is, it is calling my WordSocial plugin as well.
 *  [Matt Robinson](https://wordpress.org/support/users/mattyrob/)
 * (@mattyrob)
 * [14 years, 7 months ago](https://wordpress.org/support/topic/custom-sidebar-code/#post-2375301)
 * [@grayduck](https://wordpress.org/support/users/grayduck/),
 * That line simply invokes the class of your WordSocial plugin, if you are removing
   the filter to allow the Widget you shouldn’t need to invoke the class as it should
   already exist.
 * So, perhaps try:
    `echo do_shortcode( '[subscribe2]' );` Instead of: `$content
   = apply_filters('the_content', '<!--subscribe2-->');` And then you may not need
   to mess with the filters at all. If you keep the current approach you should 
   not need that other line anywhere.
 *  Thread Starter [GrayDuck](https://wordpress.org/support/users/grayduck/)
 * (@grayduck)
 * [14 years, 7 months ago](https://wordpress.org/support/topic/custom-sidebar-code/#post-2375305)
 * Thanks a ton for the help – I got it working by removing that other line!
 *     ```
       <?php
       remove_filter( 'the_content', array($mngl_app_controller, 'page_route'), 100 );
       $content = do_shortcode( '[subscribe2]' );
       echo $content;
       add_filter( 'the_content', array($mngl_app_controller, 'page_route'), 100 );
       ?>
       ```
   
 * _[Please post code snippets between backticks or use the code button.]_

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

The topic ‘Custom sidebar code’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 5 replies
 * 3 participants
 * Last reply from: [GrayDuck](https://wordpress.org/support/users/grayduck/)
 * Last activity: [14 years, 7 months ago](https://wordpress.org/support/topic/custom-sidebar-code/#post-2375305)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
