0

I have this code in the template file header.php:

<div class="dynamic-header">
    <?php if(function_exists('show_media_header')){ show_media_header(); } ?>
</div>

I want to process that header info on all pages, except for homepage. How I can do this?

2
  • I found that WP offers API to do this: <?php if (is_front_page() ) { get_header( 'front' ); } else { get_header(); } ?>
    – bgbs
    Commented Apr 16, 2013 at 1:27
  • 3
    Post your solution as an actual answer please, then mark it "accepted".
    – s_ha_dum
    Commented Apr 16, 2013 at 1:59

2 Answers 2

2

You can combine multiple conditional statements:

<?php 
if ( function_exists( 'show_media_header' ) 
    and ! is_home() // list of newest blog posts
    and ! is_front_page() // front page, might be a static page
)
{ 
    show_media_header(); 
} 
?>

You don’t need a separate file for that.

0

You don't need a separate file, just do:

<? if (!is_front_page()){ ?>
<div class="dynamic-header"><?php if(function_exists('show_media_header')){ show_media_header(); } ?></div><?
}
?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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