0

I'm builting my own wordpress theme and I'm trying to create a function with an if else statement to diseble the title and description of the blog when i have a custom header.

if I have a custom header i have to echo

<div class="table-cell">
<?php get_custom_header() ?>
</div>

but if not echo this code

<div class="table-cell">
<h1 class="blog-title"><?php bloginfo('name'); ?></h1>
<h5 class="blog-tagline"><?php bloginfo('description'); ?></h5>
<div class="image-title"><img src="<?php bloginfo('template_url'); ?>/images/image.png" /></div>
</div>

The proplem is that is php code within the html, i not sure if you can echo this... If there's anyway of creating an If statement to hide the title and tagline only if the custom header is being used...

0
<div class="table-cell">
    <?php if ( has_custom_header() ) : ?>

        <?php the_custom_header_markup() ?>

    <?php else : ?>

        <h1 class="blog-title"><?php bloginfo('name'); ?></h1>
        <h5 class="blog-tagline"><?php bloginfo('description'); ?></h5>
        <div class="image-title"><img src="<?php bloginfo('template_url'); ?>/images/image.png" /></div>

    <?php endif ?>
</div>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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