Slider to show on certain category

Community Forums Forums General Discussion Slider to show on certain category

This topic is: not resolved

This topic contains 9 replies, has 2 voices, and was last updated by  braddalton 1 year, 7 months ago.

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #37168

    etchattic
    Participant
    Post count: 31

    Hi all

    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-

    #37176

    braddalton
    Participant
    Post count: 10568

    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.

    Example:

    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


    #37178

    etchattic
    Participant
    Post count: 31

    Thanks Brad

    “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 response

    • This reply was modified 1 year, 7 months ago by  etchattic.
    • This reply was modified 1 year, 7 months ago by  etchattic.
    #37187

    braddalton
    Participant
    Post count: 10568

    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.

    Not difficult.

    Or you can use multiple conditionals in the one function

    Code not displaying? Grab it on Github.


    #37192

    etchattic
    Participant
    Post count: 31

    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

    Craig

    #37196

    braddalton
    Participant
    Post count: 10568

    Rapidly approaching 200. I’m trying to beat Bill Erickson!


    #37198

    etchattic
    Participant
    Post count: 31

    One thing

    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.

    Craig

    #37199

    braddalton
    Participant
    Post count: 10568

    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/


    #37201

    etchattic
    Participant
    Post count: 31

    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

    Craig

    #37203

    braddalton
    Participant
    Post count: 10568
Viewing 10 posts - 1 through 10 (of 10 total)

You must be logged in to reply to this topic.