Replacing Featured Image w/ Revolution Slider

I’ve been searching the forums off and on over the last several days in hopes of finding a solution, but haven’t had any luck. I recently started adding a “current post” slider to my posts, which pulls from the featured image. I like the look of this and would like to recreate it on past posts, but I have more than 1,000 so it isn’t feasible to go in and edit every single one. Any suggestions?

The website is www.guysdrinkingbeer.com and here is an example of a current post: https://www.guysdrinkingbeer.com/russian-river-temptation/. Theme and plugins are all up to date.

Thanks,

Karl

Hi Karl,

To add it to all your post, you can add the code below in your child theme’s functions.php file.

function add_myslider() {
    if(is_singular('post')) {
        echo do_shortcode('[rev_slider alias="test"]');
    }
}
add_action( 'x_after_view_global__slider-below', 'add_myslider', 10 );

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

You can get it from here

Hope that helps.

This did the trick. Thanks!

You’re welcome!

Just out of curiosity, is it possible to exclude posts that don’t have a featured image?

Hi there,

Do you mean to only add the revolution slider when there is a featured image to the post?

If so, please update the code to:

function add_myslider() {
    if(is_singular('post') && has_post_thumbnail()) {
        echo do_shortcode('[rev_slider alias="test"]');
    }
}
add_action( 'x_after_view_global__slider-below', 'add_myslider', 10 );

Hope this helps.

Perfect! Thanks again!

You’re most welcome.

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