“Display Site Title and Tagline” checkbox not working?

this peace of code will help you

        <?php
            if (display_header_text()==true){
                echo '<h1>'.get_bloginfo( 'name' ) .'</h1>';
                echo '<h2>'.get_bloginfo('description').'</h2>';                            
            } else{
                  //do something
            }
          ?>