WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. RyanHoeppner
    Member
    Posted 1 year ago #

    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.

  2. kevinhaig
    Member
    Posted 1 year ago #

    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!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.