Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am having problems with add_theme_support('custom-header'); I can change the Header Text color but I can't hide my Header Text when I leave unchecked "Show header text with your image" inside admin panel (obviously it should hide header text if unchecked). I have no idea should I add some specific CSS for this to work or do I have to change my functions.php? Any thoughts or suggestions? My functions.php for header support looks like this:

//Code for custom header support
$defaults = array(
'default-image'          => '',
'random-default'         => false,
'width'                  => 750,
'height'                 => 100,
'flex-height'            => true,
'flex-width'             => true,
'default-text-color'     => '#FF0000',
'header-text'            => true,
'uploads'                => true,
'wp-head-callback'       => '',
'admin-head-callback'    => '',
'admin-preview-callback' => '',
);
add_theme_support( 'custom-header', $defaults );

CSS looks like this:

a:link, a:visited{
text-decoration: none; 
color: #000000;
}

a:hover{
color: #5f5f5f;
}

h1{
  font-size: 54px;
}

#header  h1{
position:absolute;
z-index:1;
padding:0px;
margin:0px;
}
share|improve this question

3 Answers 3

@Dejo Dekic
This solution worked! for example, if you need to show the header text only when you enable(check) it, then in header.php you should have a code like this:

<?php if(get_header_textcolor()!='blank') { ?>
<!-- here is just a good example of a normal header text -->
<a href="<?php echo home_url();?>" style="position:absolute;top:100px;left:20px;color:#<?php echo get_header_textcolor();?>!important;"><?php bloginfo('name');?></a>
<?php } ?>
share|improve this answer
up vote 1 down vote accepted

I have added this code to my header.php and it worked nicely:

#header a{
<?php if(get_header_textcolor()=='blank') { 
echo 'visibility: hidden;'; } else { 
?> 
color:#<?php echo get_header_textcolor();  } ?>
}
share|improve this answer

Chances are, the theme you are using does not take into account the Custom header settings when it puts in the Site Title and Description.

I would suggest (if you are comfortable in PHP) creating a child theme (as described here) for your theme, then copy header.php into your child theme and remove/alter the area where it puts in your Site Header.

For more great tips on WordPress basics, the same guy covers a lot in his 24 Days of WordPress series.

share|improve this answer
    
To be honest this is my first theme I build from scratch and I know that I can solve that problem by using Settings API but just wanted to know if there is a easier way for making this work. So it looks like Settings API is a way to go with this one... –  Dejo Dekic Mar 1 '13 at 14:20
    
That's great. If it's a "from-sratch" child theme, then you can just dig into your header.php and work with that :). –  Eric Holmes Mar 1 '13 at 16:40

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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