Skip to main content
Changing !== operators to != so they only compare value and not value + type.
Source Link
Michelle
  • 3.5k
  • 4
  • 26
  • 34

Above answers didn't work for me - this did. This displays the site description if the box is checked and there's text in the description field.

if ( (get_theme_mod('header_text') !=== 0) && (get_bloginfo('description') !=== '') ) {
  echo '<div class="site-description">' . get_bloginfo('description') . '</div>';
}

This is also useful if you're trying to customize the display based on the Customizer's settings:

var_dump(get_theme_mods());

Above answers didn't work for me - this did. This displays the site description if the box is checked and there's text in the description field.

if ( (get_theme_mod('header_text') !== 0) && (get_bloginfo('description') !== '') ) {
  echo '<div class="site-description">' . get_bloginfo('description') . '</div>';
}

This is also useful if you're trying to customize the display based on the Customizer's settings:

var_dump(get_theme_mods());

Above answers didn't work for me - this did. This displays the site description if the box is checked and there's text in the description field.

if ( (get_theme_mod('header_text') != 0) && (get_bloginfo('description') != '') ) {
  echo '<div class="site-description">' . get_bloginfo('description') . '</div>';
}

This is also useful if you're trying to customize the display based on the Customizer's settings:

var_dump(get_theme_mods());
Source Link
Michelle
  • 3.5k
  • 4
  • 26
  • 34

Above answers didn't work for me - this did. This displays the site description if the box is checked and there's text in the description field.

if ( (get_theme_mod('header_text') !== 0) && (get_bloginfo('description') !== '') ) {
  echo '<div class="site-description">' . get_bloginfo('description') . '</div>';
}

This is also useful if you're trying to customize the display based on the Customizer's settings:

var_dump(get_theme_mods());