Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Header Image #11

Closed
grayghostvisuals opened this issue Jul 21, 2014 · 0 comments
Closed

Header Image #11

grayghostvisuals opened this issue Jul 21, 2014 · 0 comments

Comments

@grayghostvisuals
Copy link
Owner

New way to add custom header image and conditional check.

header.php

<?php $header = get_header_image(); ?>
<?php if ( $header ) : ?>
<div id="header-image">
    <a href="<?php echo home_url() ?>">
        <img src="<?php header_image(); ?>" height="<?php echo get_custom_header()->height; ?>" width="<?php echo get_custom_header()->width; ?>" alt="">
    </a>
</div>
<?php endif; ?>

functions.php

$defaults = array(
            'default-image'          => '',
            'random-default'         => false,
            'width'                  => 0,
            'height'                 => 0,
            'flex-height'            => false,
            'flex-width'             => false,
            'default-text-color'     => '',
            'header-text'            => true,
            'uploads'                => true,
            'wp-head-callback'       => '',
            'admin-head-callback'    => '',
            'admin-preview-callback' => '',
        );
add_theme_support( 'custom-header', $defaults );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant