Support » Plugins and Hacks » Specific header image for specific category?

Specific header image for specific category?

  • Is there a way to specify a header image for a specific category?
    I’m using the Graphene theme.

    Thanks in advance for any help.


Viewing 15 replies - 31 through 45 (of 86 total)
  • Ok here is what I’m finding…
    Yahooo for blog posts assigned to the category “blog” by inserting the cat id in the array…works PERFFECTLY. So easy, so perfect.

    The one where it didn’t work was a page instead of a blog post I assigned to the category blog.

    Does the code only work for posts, not for pages?
    Something different I need to do other than assign an existing page to the category “Blog”?

    Example..I have the page “flight deals” in the menu under Blog menu item
    It’s a page which I assigned to the category Blog but it’s still showing regular site headers…?

    Amazing commenting…so great!

    So I’ve played around with it and indeed it works perfectly for single posts, just as you say! Fantastic!

    I was also hoping it work for pages as most of the content I have so far is as pages not posts.

    Can it also be made to work with pages as well as posts?
    (Please don’t kill me) 🙂

    Actually I have another snag with the posts…I must be doing something wrong

    I made a post called “flight deals test post”
    I assigned it to a new sub category “flight-deals” (slug)
    This sub category is assigned to “juicy-travels-blog”
    I have a folder /graphene-child/images/custom-headers/juicy-travels/blog
    and within that folder I have

    But the test post flight deals only shows headers from the main /juicy-travels-blog/ folder, not the /flight-deals/folder.

    I’ve tried assigning the post to just the sub cat flight-deals and to both juicy-travels blog and flight-deals. Either way it doesn’t show the headers from the /flight-deals/ folder.

    What step did I miss? 🙂

    Hey! I was wrong! I had to clear my cache a few times and that part works great..never mind, sorry!

    So the only potentially big question is…can we also make this work for pages as well as posts?

    See how on the main blog category page (perfect)

    The bottom one called Flight Deals is a page…but so when you click on it you see the main site header not the blog header…I was hoping to be able to include both posts and pages in a category and have them show the header assigned to that category, like “blog”…

    Hi again,

    I just got back home.
    I’m glad to know it is working as intended!

    As for pages, well, it was never meant to work for pages, because you mentioned you wanted custom images for category archives and single posts. Pages and posts are two distinct types of content that are organized differently, so you can’t really assign categories to pages. Posts are organized inside a category hierarchy, and pages inside a page hierarchy, both of which are separate.
    This is why I’m a little confused as to what you mean when you say:

    The one where it didn’t work was a page instead of a blog post I assigned to the category blog.

    What I would do if I were you, is turn “Flight Deals” into a post, and assign it the Level 1 category “juicy-travels-blog” and all the sub-categories you desire, and that should force the custom images to display.

    Let me know if this makes sense to you.

    Actually I always wanted it to be for pages and posts…I just read back through the beginning of our thread here and I did say that. I’m wondering if it might be do-able since my original code from Syahir was working for regular pages…just not the category archive page.

    Let me try to put it back to what he originally gave me and confirm that this is true…

    Well I was totally wrong! It didn’t work for pages.
    So actually..what we have now is fine because it just occurred to me I can use a featured image and just make it bigger than the header size so I can always assign a single relevant image for a page, it just won’t have the benefit of being part of that random rotating from a folder option. I can totally live with that.

    Do we know of any custom header option for PAGES not posts that lets you assign random images from a folder like we did for the posts? 🙂

    Sorry if I confused you or was confused myself…I thought we were doing it for pages and posts but if it can’t be done then it can’t be done and a single specific header on a page will work. I’d rather be able to do like we are doing and give a page a random rotation but it’s not all that important.

    I think what you have done is so wonderful…thank you so much! And I really so impressed with your commenting…that sure makes it easy for someone else to follow it.

    Is it ok if I post it with credit to you on the Graphene forum so I can close out those threads?

    I am so so grateful to you…I spent weeks trying to solve this one! THANK YOU!

    Syahir’s original code checks whether it is a category or a single post at the very beginning:

    if ( is_category() || is_single() ){

    so I would be surprised that it would work for pages as well, because that statement should return false for pages. The test for whether you are inside a page or not is


    That being said, you could still try to turn the page in question into a post and that should do the trick.

    Yes you were right 🙂 Of course.

    I was editing my post when you answered and I don’t know if you saw my last sentence, so here it goes again just in case: can Flight Deals be turned into a post instead of leaving it as a page, or would you need to include other pages in there as well?
    The code could be reworked to fit pages as well, but I would have to rethink the whole thing, so unless you really need to use pages, I don’t know if it’s worth the effort.

    Well…I think so long as I can assign a single image to a particular page it’s not worth the effort.
    If it were a plug in or something I’d say it would be nice if it could do both. By the way this would be a very popular plugin I think! 🙂

    You did such an awesome thing for me to do this…thank you so very much.

    How would I contact you directly if I had a project?

    And is ok to post this on the Graphene forum on your behalf to close out my three open threads on this topic? 🙂 I think other people will really be able to benefit from this!

    I am glad you are overall happy with the script. I’ll try to see if I can make some time during the weekend to make it work with pages, but I can’t make any promises.
    As for your contact request, you can e-mail me at wp-forums[atsymbol]elblawg[period]com. Sorry for the convoluted address, but I like to keep my inbox as span-free as possible, :-).
    Oh, you can totally share the link to the script: if I can make it work for pages, I’ll simply update the code in the Pastebin.

    Thank you so so so so much!!! I am so grateful!!!

Viewing 15 replies - 31 through 45 (of 86 total)
  • The topic ‘Specific header image for specific category?’ is closed to new replies.