Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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?

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

2 Answers

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.

share|improve this answer
add comment

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><?
}
?>
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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