2

I registered the widget area in my functions.php and they appear in my admin area but when I drag it over to the right hand panel to make changes none of them seem to do anything.

Anyone know what I can do to find a solution to this problem?

The widget in question is WP YouTube Lyte

Edit:

add_action( 'widgets_init', array(&$this,'arphabet_widgets_init'));
function arphabet_widgets_init() {

    register_sidebar( array(
        'name' => 'Home right sidebar',
        'id' => 'home_right_1',
        'before_widget' => '<div>',
        'after_widget' => '</div>',
        'before_title' => '<h2 class="rounded">',
        'after_title' => '</h2>',
    ) );
}
7
  • Show us the code of the template that is running the widget area. As well as the accompanying registration code.
    – GhostToast
    Nov 8, 2013 at 20:24
  • This question is unanswerable without seeing your actual code. Nov 8, 2013 at 20:26
  • I've added the registration code, but what do you mean by the template code?
    – UzumakiDev
    Nov 8, 2013 at 20:28
  • 1
    That code registers a dynamic sidebar area. It's one of three parts of potential code: 1) registering the sidebar area (which you have here), 2) Outputting the sidebar area in the template (via dynamic_sidebar() call), and 3) Defining custom widgets (if applicable). Nov 8, 2013 at 20:30
  • Ah....... that would be the problem.
    – UzumakiDev
    Nov 8, 2013 at 20:32

1 Answer 1

4

It sounds like you're trying to add a new widget area (dynamic sidebar) to your Theme.

That process has three parts:

  1. Register the dynamic sidebar in functions.php, using register_sidebar():

     function wpse121723_register_sidebars() {
         register_sidebar( array(
             'name' => 'Home right sidebar',
             'id' => 'home_right_1',
             'before_widget' => '<div>',
             'after_widget' => '</div>',
             'before_title' => '<h2 class="rounded">',
             'after_title' => '</h2>',
         ) );
     }
     add_action( 'widgets_init', 'wpse121723_register_sidebars' );
    

    This registers the dynamic sidebar with WordPress, which displays its UI in Appearance -> Widgets in the Admin. The important part here is the id parameter, which you'll use in the next step:

  2. Output the widget area (dynamic sidebar) in your Theme template, wherever appropriate, using dynamic_sidebar( $id ):

     <?php dynamic_sidebar( 'home_right_1' ); ?>
    

    This actually displays the dynamic sidebar in the template.

  3. Populate the dynamic sidebar, via Appearance -> Widgets in the Admin.

It sounds like you've done #1 and #3, but not #2.

4
  • I seemed to have completely glossed over a lot of what actually was involved in using widgets, I basically assumed I just had to activate it and then it would automagically work. The widget I want to use is called WP YouTube Lyte.
    – UzumakiDev
    Nov 8, 2013 at 20:49
  • 1
    You should be able to add any given Widget to any given Widget area (dynamic sidebar). Nov 8, 2013 at 20:50
  • I'm with it now :D it's working, thank you for your time.
    – UzumakiDev
    Nov 8, 2013 at 20:54
  • 2
    Thank you for your helping answer. Under point 2. of it you made a typo. "dymamic". Threw an error here and then I saw it was spelled with an "m".
    – lowtechsun
    Sep 7, 2017 at 14:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.