Support » Themes and Templates » Remove Whitespace from empty titles of widgets on sidebar

  • I added a second widgetized sidebar to a theme and I am trying to figure out how to remove the whitespace from a widget that doesn’t have a title. In the functions php I added this code:

          'id' => 'left',
          'name' => __( 'left' ),
          'description' => __( 'Left Sidebar' ),
          'before_widget' => '<div id="%1$s" class="widget %2$s">',
          'after_widget' => '</div>',
          'before_title' => '<h3>',
          'after_title' => '</h3>'

    and I because of the h3 tags it appears to be just trying to keep the space open for a title regardless of if there is one on the widget. If I place the title onto the widget it shows up and fills the whitespace. For this theme, I would like to have some sort of if statement in place that detects the presence of a title before proceeding to reserve that space so that the theme comes out clean.

    Does anyone have a clue on how to implement that? I have no idea where to start or what syntax would be needed.

    Thanks in advance.

Viewing 3 replies - 1 through 3 (of 3 total)
  • I am pretty sure I could put an if statement before this:

    'before_title' => '<h3>',
          'after_title' => '</h3>'

    My question is, is there something like this?

    if (widgetHasTitle)
    'before_title' => '<h3>',
          'after_title' => '</h3>' }
     {'before_title' => '',
          'after_title' => ''}

    The API must have a solution right?



    was a solution ever found?



    No, I haven’t found a solution. The best thing I can suggest is putting some information into the title of the widget at all times.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Remove Whitespace from empty titles of widgets on sidebar’ is closed to new replies.