WordPress.org

Ready to get started?Download WordPress

Forums

Custom Header/Logo or Default Site Title (1 post)

  1. krollins
    Member
    Posted 1 year ago #

    Hi everyone, hopefully you can help me with this little coding conundrum!

    I've just got the custom header function working in my theme. I want to use it as a way of the user uploading a custom logo OR if they don't have one I want it to default to text. So far I haven't been able to get the text function to show up instead of the image in it's absence. I'm sure it has something to do with the code in my header.php file.

    Here's what I have in function.php

    add_theme_support( 'custom-header', array(
    	'flex-width'    => true,
    	'width'         => 600,
    	'flex-height'   => true,
    	'height'        => 300,
    	'header-text'   => true,
    ) );

    And what I have in header.php

    <a href="<?php echo home_url() ?>/" title="<?php bloginfo( 'name' ) ?>" rel="home">
    <img src="<?php header_image(); ?>" height="<?php echo get_custom_header()->height; ?>" width="<?php echo get_custom_header()->width; ?>" alt="" />
    </a>

    I know I need to add something to the header.php code, just not sure what it is?

    Your help is appreciated, thanks in advance!

Topic Closed

This topic has been closed to new replies.

About this Topic