• Resolved GrayDuck

    (@grayduck)


    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)
  • Try another plugin…
    Wp-Autoresponder

    @grayduck,

    You could place the widget manually or Widget enable your theme.

    To manually place it read here.

    Thread Starter GrayDuck

    (@grayduck)

    Thanks MattyRob… I’m half way there!

    I’m stuck and my problem was addressed here. 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.

    @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

    (@grayduck)

    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.