WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] [Theme: Twenty Eleven] Specific Header Image for Category (5 posts)

  1. howsockgothappy
    Member
    Posted 1 year ago #

    Hi! I wanted static pages on my website that do not show blog posts, and certain pages that show only a specific category of blog posts. So far I have everything as I want it, except that for the category page, the header image is the same as the front page. Previously, when I was using actual pages as navigation instead of category links, I had a specific header image for each page. I would like to have a specific header image for the category "page" but my attempts to use conditional tags ended in the website completely not functioning. Going to the URL directed me to a blank page reading html errors on certain lines.

    Does anyone know how I can get this specific header image for the page?

    The website is http://www.lansdownefarms.ca and the page in question is the "For Sale" page. (The website is a Father's Day gift for my dad who has just started a hobby farm. I don't think he will really care, to be honest, but I would like to make the website as good as possible, since it IS a gift!)

  2. howsockgothappy
    Member
    Posted 1 year ago #

    Forgot to mention, I think my earlier problem may have been where I was inserting the code, so if you can specify where my code should be going, it would help. Also, I am using the theme Twenty Eleven.

  3. paulwpxp
    Font hero
    Posted 1 year ago #

    Referring the line #number from here.
    http://themes.trac.wordpress.org/browser/twentyeleven/1.5/header.php

    Put this in between #L99 and #L100

    elseif ( is_category( 'cat-a' ) ):
    				?>
    					<img src="http://dummyimage.com/1000x288/ff0000/fff.png" width="1000" height="288" alt="cat-a" />
    				<?php
    					elseif ( is_category( 'cat-b' ) ):
    				?>
    					<img src="http://dummyimage.com/1000x288/00ff00/fff.png" width="1000" height="288" alt="cat-b" />
    				<?php
    					elseif ( is_category( 'cat-c' ) ):
    				?>
    					<img src="http://dummyimage.com/1000x288/0000ff/fff.png" width="1000" height="288" alt="cat-c" />
    				<?php

    Change image url, width, height, alt.

    and change category slug from cat-a, cat-b, cat-c to yours.

  4. howsockgothappy
    Member
    Posted 1 year ago #

    That worked! Thank you so much. :)

  5. paulwpxp
    Font hero
    Posted 1 year ago #

    Use child theme, if not all changes will be lost when theme updates.
    http://codex.wordpress.org/Child_Themes

Topic Closed

This topic has been closed to new replies.

About this Topic