WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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

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
Post your solution as an actual answer please, then mark it "accepted". – s_ha_dum Apr 16 '13 at 1:59

You can combine multiple conditional statements:

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

You don’t need a separate file for that.

share|improve this answer

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

Your Answer


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.