Here’s some sample code you can use for the header or background. This uses the genesis header hook which you can change to a theme specific hook or WordPress hook.
add_action('genesis_header', 'conditional_header_image');
function conditional_header_image() {
if ( is_tag('your-tag')) {
echo '<div class="home-header"><img src="http://example.com/path/to/image.png" alt="home header image" /></div>';
elseif(is_page() )
echo '<div class="page-header"><img src="http://example.com/path/to/image.png" alt="page header image" /></div>';
}
}
Untested.
I would look at the code in the Twenty Eleven theme to see how they use random headers and add conditionals to that.
Related Posts:
- Edit the_category (); for a hierarchical display
- Multiple Tag Filtering
- What does the token %1$s in WordPress represent [closed]
- How to automatically apply woocommerce product title to all product images alt tags?
- exclude multiple terms using get_terms() function
- Archive listing of posts by publish year (multiple years)
- Add custom field to attachments in a specific category
- Display all posts in current category
- display most popular tags in two columns
- How to display related posts from parent category
- How can I set custom order use this function
- Displaying Only Certain Tags in Loop
- query if on page/2/?
- Put a link to a category round a hard coded A HREF
- Check if Product is in a Specific Category in Functions.php
- Add relevant tag to search results
- Category Thumbnail Display – How to display ONLY the main Category
- How to create a linked tag list in my sidebar
- Way to querry data (tags) from a wordpress database?
- Creating a related post section based on similar categories
- Swapping wp_dropdown_categories function with wp_category_checklist
- Issue adding sub category programmatically
- Grab posts by multiple categories
- get_template_part based upon post’s category
- how to save selected option in variable for rest api category filter
- Recent Posts Not Showing Only On A Specific Category Page [closed]
- Display category name only once inside loop
- Adding Taxonomy Image to taxonomy loop [closed]
- how to show only specific category for a template
- Pull Tags But Not as Links
- Adding Meta Tags to a Post using its Tags, Excerpt and content
- Creating sub-categories via php
- Define specific category name in PHP
- How to array only one key from another array
- Use Tags to initiate Search
- I’m trying to create an array with a foreach loop, but the array only stores the last item [closed]
- Filtering a function’ output for a new continued function
- Displaying posts based on category
- How do I remove a category from a wordpress loop>
- Get categories names as an array to use it in theme settings
- How to get the last category name of a child category?
- How to separate categories with commas?
- Show all tags within a category?
- Add new post in existing categories using wp_insert_post
- How to change logo by category
- Problem with custom loop and wp_list_pluck [closed]
- Alphabetically Ordered Category in WordPress
- Loading Posts & Category with Ajax
- How to get current category
- How to tag the main tag? [closed]
- WooCommerce: Display product categories to make IF statement
- Trying To Get Child Categories To Show, Issue With foreach Loop
- Define category ID using get_post_meta
- How to add Post Tags to a new element in header.php?
- Show parent categories of the current category
- How to check if a category has a parent and child categories?
- Commas in Tag Cloud
- Get category id when SEO URL is turned on
- making my own “related pages” / “pages you might like” section
- Display latest post from WordPress Featured Category that is also in X,Y,or Z categories
- Getting a WordPress tag to print inside of a traditional php echo
- Display Sibling WooCommerce Product Categories on Archive Page
- display the months of a specific category
- I need to display posts in subcategory beside posts in main category
- Add Custom Category Description When Empty
- Order category posts by last word of custom field
- Add a product category to a specific product via a button
- List sub categories and corresponding posts of a parent category
- Dropdown category field inside repeatable metabox
- How to add Text before my Custom Term and hide it when empty
- clicking on the_tags() generated tags to show all tagged posts page
- How to Link to category titles if it is in the single post content?
- How can i show specific Category List?
- How to put a before and after with tags in a wordpress entry?
- How to show category just on specific pages?
- How to filter specific element of an array in wordpress/php?
- All categories options or All categories not Populating
- View tag description on page
- Display tag links on archive page?
- List categories assigned to a post
- How do you change the tag font size in the repeater-template.php [closed]
- PHP tag in post content makes wordpress go crazy
- Unable to get Post Category Name and URL
- Display product attributes for current product
- How to only fetch certain Tag ID’s
- How to add style in functions.php depending on conditions?
- How do I display Category titles on a WP Page?
- problem with category menu, it doesn’t want to show link
- Saving category as insert post
- Trying to see if page is category or single and displaying title with appropriate heading tag
- WordPress – show all posts + ones with specific tag
- !in_array doesnt recognize category
- How to change links in the 3 main categories, on widget category, to a javascript function call
- how to set category name for a post
- category & sub category order issues in wordpress
- Fix incorrect related posts code snippet
- Display a list of posts corresponding to a category
- How to create categories out of a list of words?
- how to loop through blog posts in php
- Is there a way of displaying related posts from lowest hyrachical order (lowest child category to parent category)