Skip to content

Instantly share code, notes, and snippets.

@grtaylor2
Created December 18, 2012 23:08
Show Gist options
  • Save grtaylor2/4332961 to your computer and use it in GitHub Desktop.
Save grtaylor2/4332961 to your computer and use it in GitHub Desktop.
Specific WordPress header by category. This will work for both the category archive page and all individual posts marked with specific categories.
<?php if ( is_front_page() ) : ?><img src="<?php echo get_stylesheet_directory_uri(); ?>/images/specific image for cat">
<?php elseif ( is_category( 'category 1' ) || has_category ('category 1')) : ?>
<img src="<?php echo get_stylesheet_directory_uri(); ?>/images/specific image for cat">
<?php elseif ( is_category( 'category 2' ) || has_category ('category 2')) : ?>
<img src="<?php echo get_stylesheet_directory_uri(); ?>/images/specific image for cat">
<?php elseif ( is_category( 'category 3' ) || has_category ('category 3')) : ?>
<img src="<?php echo get_stylesheet_directory_uri(); ?>/images/specific image for cat">
<?php elseif ( is_category( 'other' ) ) : ?>
<img src="<?php echo get_stylesheet_directory_uri(); ?>/images/specific image for cat">
<?php else: ?>
<img src="<?php echo get_stylesheet_directory_uri(); ?>/images/specific imagge for cat">
<?php endif; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment