WordPress.org

Support

Support » How-To and Troubleshooting » How to add custom header image (what is PHP/HTML code?)

How to add custom header image (what is PHP/HTML code?)

  • I added the support in the functions file to add a custom header image but I’m not sure what PHP/HTML to add in the (div id=”header) for it to work properly. My text won’t disappear even if I uncheck the “Show header text with your image.” Please help! I’m looking mostly for some code options here. I’ve tried looking over wordpress codex.

Viewing 1 replies (of 1 total)
  • The twentyeleven theme goes into it in it’s header.php file.

    Here’s what I used to display just a logo…no text.

    <?php
       if( function_exists( 'get_custom_header' ) ) {
          $header_image = get_header_image();
          If ( $header_image ) : ?>
              <div class="header_image">
                 <a href="<?php echo site_url(); ?>/">
                    <img class="logo"
                    src="<?php header_image();?>"
                    height="<?php echo get_custom_header()->height; ?>"
                    width="<?php echo get_custom_header()->width; ?>"
                    alt="logo" />
                  </a>
                </div>
              <?php endif; } ?>

    Hope it helps!

Viewing 1 replies (of 1 total)
  • The topic ‘How to add custom header image (what is PHP/HTML code?)’ is closed to new replies.
Skip to toolbar