• 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.

    Laura

Viewing 15 replies - 46 through 60 (of 86 total)
  • You are welcome, ??

    So…
    I managed to make it work for pages too!
    Booya! ??
    Here is the new version.

    Cheers!

    Thread Starter raindance

    (@raindance)

    Wooohoooooooo no way really?? You ROCK! You are my hero ??

    I’ll post it in Graphene now…your ears must have been burning…someone always very helpful in that forum just said “wow so happy to see you solved it finally” as he’s watching this thread also…and there you are with an even better solution!! Yipppeeee!!!

    THANK YOU MARVELOUS MARVENTUS!

    Thread Starter raindance

    (@raindance)

    So Im thinking I must be doing something wrong…
    I’ve got the same..
    https://juicytravels.com/category/juicy-travels-blog/

    And the page is
    https://juicytravels.com/flight-deals/

    Its assigned to the category Blog (slug = juicy-travels-blog)
    I use Map categories to pages (it doesn’t seem to show sub categories hierarchy though)

    But that page still shows the general site headers?
    Where have I gone wrong? ??

    I think the Map Categories plugin might be the culprit.
    What happens if you create a new parent page, say Page Test (slug page-test), create a folder page-test inside images/custom-headers/, upload some images to that folder, and include the page ID in the $custom_image_ids array? Do custom images appear for the Page Test?

    Thread Starter raindance

    (@raindance)

    Ok will try it now…thanks!
    Sorry…server was down all morning, arrgh.

    Also did you get my email?

    Thread Starter raindance

    (@raindance)

    I just added the page id in like this:
    /* CATEGORY AND PAGE IDS FOR CUSTOM IMAGES */
    $custom_image_ids = array(52,220); // modify at will

    But it still doesn’t show the images from the /custom-headers/juicy-travels-blog/
    or
    /custom-headers/juicy-travels-blog/flight-deals

    Page id is 220, slug is flight-deals

    I tried disabling map categories to plug in page but realized then it has no idea that the page id goes to that blog category, nor anyway to assign pages to categories, right? So I re-activated it.

    It’s not a disaster, I can use single images, but if I’m just doing something wrong then I ought to correct it.

    It’s still working good for the blog posts and category archive page.

    Thread Starter raindance

    (@raindance)

    Ohhhhhhh my fault entirely…
    I thought the flight-deals needed to be IN the juicy-travels-blog folder…but no it needed to up a level…
    And VOILA works perfect…sorry! My fault!

    So the trick is to be sure for pages to:
    1. Put the page id in the array with the category id
    2. put the folder named after slug of page title in the images/custom-headers/ folder, not inside the slug named folder of the parent category.

    Which now that I read it for the third time I think you explained perfectly and I just missed it…yeay!

    So wonderful to have this dialed in…THANK YOU! ??

    Hi Laura! Good thing you were able to figure it out.
    The reason why you needed to place your page images inside custom-headers is because that page does not belong in the category hierarchy, and obeys a different hierarchy. The fact that you force WP to treat a page as a category or perhaps to display posts inside pages, does not have any impact on your content organization: Flight Deals is still a Level 1 page and will be treated as such by WP.
    Let me know if this makes sense to you.

    Thread Starter raindance

    (@raindance)

    It totally makes sense, thank you so much for explaining it so clearly and for your patience with me! It’s so fun to have it working…thank you!

    Hello there,

    As I told Raindance in another forum, I have some trouble implementing this new feature and code you created. I must be doing something wrong, but I don’t see what exactly.

    – I created folders in my FTP that correspond with my categories’ slug:
    /wp-content/themes/graphene/images/custom-headers/competition
    /wp-content/themes/graphene/images/custom-headers/stades

    – I uploaded in these folders appropriate jpeg images (they work all of them if I use them separately as a header)
    – I putted the code you created into my functions.php file (and I modified it, so that the ID of my categories are in it)
    – I checked the ‘Random header’ box on graphene header interface

    Unfortunately as a result I don’t get any custom headers displayed…
    Before I deleted them on the FTP, I got the default header images displayed. Now that I deleted them on the FTP, I get no header at all. So it seams that it doesn’t pick any images from custom header folder.

    Any idea what I could try?

    I saw that Raindance is using a child theme. could it be the problem, something to adapt in the code ? (Graphène is my main theme, I’m using only one theme.)

    Many thanks for your help,

    Oh yes I forgot to tell:
    I’m using WordPress 3.1.2 and Graphene 1.3

    Thanks

    Hi Romain,

    Did you try clearing your browser cache?
    Also, do you have any caching plugins installed on your site, such as WP Super Cache or W3 Total Cache? Those plugins are not compatible with rotating header images, since they cache (store) a static version of your blog pages. If you have one of these plugins installed, try to regenerate the cache from the plugin options see if there are any changes.

    I can guarantee the code works on WP 3.2.1 and Graphene 1.5.5 (i.e., both latest versions), but I haven’t tested it older versions. Another thing worth mentioning is that I tested this code inside a Graphene child theme, not on the actual theme itself.

    I hope these pointers are helpful. If you still can’t figure it out, let me know.

    Cheers!

    Hi Marventus,

    Thanks so much for the answer. Yes I cleaned my cache (I do not use Cache plugins), but it didn’t solve the problem.
    In my site, rotating headers worked with default images and default graphene feature, so I don’t think this is the issue.
    I guess the problem is :
    either on not using a child theme, or on not using the latest version of Graphene (or wordpress, but I don’t think so).

    I’ll have a look at it later today and let you know.

    So,
    I tried the script on the Graphene theme directly, and it worked like a charm, both for categories and pages.
    The script, which is basically a filter function, has to be pasted in the functions.php file after the function named graphene_get_header_image (i.e., after the add_action command). By “after” I don’t mean right after: the script should work as long as it is placed below the graphene_get_header_image function.
    If you don’t want to mix theme functions and custom functions in the same file, you could create a file called user-functions.php in your theme folder, paste the script there, and insert this line of code at the end of functions.php (before the php closing tag):

    include_once (TEMPLATEPATH . '/user-functions.php');

    If that doesn’t work, you could try updating WP and Graphene, assuming this is an option for you, of course. If it isn’t, there’s one more thing you could try, which is disabling all the plugins to make sure they are not interfering with the loading of the images.

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