WordPress.org

Ready to get started?Download WordPress

Forums

How to put widget on one page only (10 posts)

  1. Marcusitl03
    Member
    Posted 4 years ago #

    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

  2. Micah Cooksey

    Posted 4 years ago #

    Try using a custom page template.

  3. Marcusitl03
    Member
    Posted 4 years ago #

    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

  4. Micah Cooksey

    Posted 4 years ago #

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

  5. Marcusitl03
    Member
    Posted 4 years ago #

    its called flashlog from nattywp

    very nice of you, thanks

  6. PurpleCrow
    Member
    Posted 4 years ago #

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

  7. PurpleCrow
    Member
    Posted 4 years ago #

    Aha! Found it - Widget Logic

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

  8. Micah Cooksey

    Posted 4 years ago #

    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(); } ?>
  9. Micah Cooksey

    Posted 4 years ago #

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

  10. PurpleCrow
    Member
    Posted 4 years ago #

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

Topic Closed

This topic has been closed to new replies.

About this Topic