WordPress.org

Support

Support » Themes and Templates » How to put widget on one page only

How to put widget on one page only

  • http://www.pushsaturdays.com

    you see i have a music player to the right. when i go into the other pages, for example about or pezl mixes, that music player follows along. i dont want that.

    i need to know how to set a widget to be on one certain page only, and not for all of them.

    please help.

    thank you

Viewing 9 replies - 1 through 9 (of 9 total)
  • Try using a custom page template.

    hmm ok seems advanced… im really not good at this stuff…

    so i should change something in the editor fields ? sounds dangerous in case i mess something up

    What theme are you using so I can give you some more specific advice?

    its called flashlog from nattywp

    very nice of you, thanks

    Theres a plugin for this… I’ll get back to you if I find it again!

    Aha! Found it – Widget Logic

    I think thats what your looking for… Ignore me if its not!

    Ok, add this to your theme’s functions.php:

    register_sidebar( array (
    		'name' => 'Sidebar 2',
    		'id' => 'sidebar-2',
    		'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
    		'after_widget' => "</li>",
    		'before_title' => '<h3 class="widget-title">',
    		'after_title' => '</h3>',
    	) );

    Then find the place in your page.php where it says something like this:

    <?php if ( !function_exists('dynamic_sidebar')
            || !dynamic_sidebar() ) : ?>

    and replace it with this:

    <?php if ( is_page(your_page_name) ) { get_sidebar( 'sidebar-2' );
    } else { get_sidebar(); } ?>

    Edit– I completely forgot about that plugin. That will be much simpler. Thanks PurpleCrow!

    My pleasure! Its a cleaver little plugin I think, found it while scrolling through about a million plugins LOL

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘How to put widget on one page only’ is closed to new replies.