Adding revolution slider below header on category page

Hey. I notice that I can add the revolution slider beneath the masthead on my Posts (Blog) page.

Would someone please assist me with the code to put into the functions.php so I can choose a revolution slider to appear beneath the ‘Category’ archives?

I have something like that for the Buddypress page, so I know it’s do-able. With the right code, I could just put the shortcode of the slider in the functions.php and change the slider (for all category archives).

:slight_smile:

Hey Peter,

Since you have something similar with BuddyPress, you probably just need to edit the BuddyPress condition in the code with a is_category conditional.

If that doesn’t help, please give us the URL of the category page in question so there’s a chance we could advise a specific solution.

Thanks.

Yah Christian I wouldn’t (yet) fully understand the translation between the two bits of code, even though I somewhat recognize they are ‘hooking’? ‘calling’? a similar thing into being.

here’s an example of a category page --> https://intothemythica.com/category/academy-2/academy/

(note - I am wondering why my sidebar is not appearing on that page, but first things first) …

essentially, I just want to be able to assign a particular slider revolution to appear underneath all category pages, the way I can assign a slider revolution to regular pages.

I know this is a code-thing and would be a snippet of .php.

Hi Peter,

First, you need to set up a child theme and activate it by following our guide here.

Then you can add a slider to your category page using an action and revslider shortcode.

Please add an example code below in your child theme’s functions.php and set your parameters there.

function add_my_slider() {
      if(is_category( '78' )) {
            echo do_shortcode('[rev_slider alias="test"]');
     }
}

add_action( 'action_name', 'add_my_slider', 10 );

is_category() is a WordPress function which accepts category slug, category ID etc which you can read from here.

action_name parameter can be replaced with any hooks mentioned here. In your case, you can try the following hook x_before_the_content_begin.

Change [rev_slider alias="test"] with your slider shortcode.

Please be reminded that this is a customization and outside of support that we can offer, please take the snippet as a guide with the understanding that it would ultimately be your responsibility to take it from here.

I hope that helps,
Cheers!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.