Support » Fixing WordPress » register_sidebar() not working as I thought it would

  • Hello,

    I am registering a new sidebar, and then placing into my child theme:

    register_sidebar(array(
      'name' => __( 'Top Text Bar' ),
      'id' => 'top-bar',
      'description' => '',
      'class' => 'top-bar',
      'before_widget' => '<div id="%1$s" class="widget %2$s">',
      'after_widget'  => '</div>',
      'before_title' => '',
      'after_title' => ''
    ));

    Where I am using 'before_widget' => '<div id="%1$s" class="widget %2$s">',, I thought my front-end code would look like:

    <div id="top-bar" class="top-bar">

    But instead, it looks like:

    <div id="text-5" class="widget widget_text">

    Can someone tell me what I am doing wrong? I thought that if you defined an ID and Class within your register_sidebar function, it was supposed to use them within your front-end markup?

    Thanks!

Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘register_sidebar() not working as I thought it would’ is closed to new replies.