April 23, 2013 at 10:13 am #37168
Does anyone know of a slider / Banner plugin that allows the banner to change depending on what category the page is.
Say I click on a post called dogs collar and that post falls under the category of dogs. The banner would be specifically for a dog slider. If I clicked cats treats the category would be cats and show the cats slider.
Thanks for any feedback in advance
-Craig-April 23, 2013 at 10:42 am #37176
Yes and there's many ways to do this which i have already written about.
Just to clarify, you want to display a custom header image (What you call a banner) which is different for each category archive?
Or display a custom header depending on what category the posts are assigned to.
All posts under the category DOGS will display one specific header image for that categories posts.
You can use:
1. A plugin
2. CSS Code
3. PHP with conditional tags
April 23, 2013 at 10:50 am #37178
"Or display a custom header depending on what category the posts are assigned to." that is spot on as long as the custom head section makes the slider category = the post/page category.
It would be multiple sliding images using a slider plugin.
I was thinking the slider could have the same category as the post/ page category and with PHP you could assign that the category of the slide and the post/page must = but if there is no match the home page slider will show.
Hope that made sense. I'm pretty new when it comes to PHP but I've been getting my hands dirty and am amazed at what can be achieved, so would like to go the PHP route. If you know of any tutorials and could point me in the right direction that would be awesome.
Thanks again for the quick responseApril 23, 2013 at 11:18 am #37187
Awesome, Most people go the plugin route which is too easy.
Got heaps of code snippets and tutorials on how to do this.
Firstly, you can use PHP with a conditional tag and hook it into the header or any other hook location.
You'll need to create a different slider for each category and then upload images for that category (simple).
That will then give you a list of shortcodes or PHP with different i.d's which you can use in your custom functions as shown above.
Change the conditional tag for is_category('i.d here') in the code and thats basically it.
Or you can use multiple conditionals in the one function
Code not displaying? Grab it on Github.
April 23, 2013 at 11:36 am #37192
Brad your a legend
Just checked your wpsites site now. I think I have just stumbled upon the holy grail of code snippets.
Thanks I really appreciate the help
CraigApril 23, 2013 at 11:43 am #37196
Rapidly approaching 200. I'm trying to beat Bill Erickson!
April 23, 2013 at 11:48 am #37198
Is it not possible to make the category of the page automatically call the category of the slider. Say for instance a Client adds a new category, that category wouldn't be in the conditional functions and would have to be manually coded.
CraigApril 23, 2013 at 12:02 pm #37199
Pretty much anything is possible with PHP. It would require a bit more than what's in my code snippets as they're basic custom functions with different conditional tags and Genesis hooks.
Not sure of your level but here's a good beginners guide to PHP http://devzone.zend.com/4/php-101-part-1-down-the-rabbit-hole/
April 23, 2013 at 12:08 pm #37201
I'm a total greenhorn, cutting and pasting with tweeks and workarounds to get things going but I can see the light at the end of the tunnel. To be honest I'm needing to step up and get a deeper understanding, fortunately it always seems like I have to much work and not enough time to study.
Thanks for the help
CraigApril 23, 2013 at 12:11 pm #37203
- The forum ‘General Discussion’ is closed to new topics and replies.