Slider revolution in post pages

Hi there, I have done this in the past, but now for some reason doesn’t work. I have to put a revolution slider insider the blog page an the single post pages.

I’m trying to achieve this with this code:

function add_home_slider(){

if ( is_singular('post') && is_home() ) {
 add_revslider('Home-opening-slider');
  }
}

add_action('x_before_view_global__slider-below', 'add_home_slider');

Maybe I’am forgetting somethings…Can you help me? Thank you very much

Hi Alessandro,

It should be echo do_shortcode('[revslider_shortcode]’); and not add_revslider('Home-opening-slider’);

Please also try the following filters in case your code does not work:

add_action('x_before_view_integrity__landmark-below', 'add_home_slider’);

Or

add_action('x_after_masthead_end-below', 'add_home_slider’);

Hope this helps.

Hi, thank you for your response.

With the new version of Slider Revolution echo do_shotcode doesn’t work anymore. They have implemented the new add_revslider code template.

I have made some tests and I have found the only working function is this:

function add_home_slider(){

if ( is_singular('post') ) {
 add_revslider('Home-opening-slider');
  }
}

add_action('x_before_view_global__slider-below', 'add_home_slider');

And it displays revolution slider inside sigle posts. If I add the && is_home() the function stops working also for single posts and the revolution slider is not shown.

On the other hand, I have tried to use only is_home in this way:

function add_home_slider(){

if ( is_home() ) {
 add_revslider('Home-opening-slider');
  }
}

add_action('x_before_view_global__slider-below', 'add_home_slider');

And it works, displaying the rev slider inside the blog page. So, I assume the problem is the php operator &&.

So, I have tried another function:

function add_home_slider(){

if ( is_singular('post')) {
 add_revslider('Home-opening-slider');
  }
  elseif (is_home()) {
    add_revslider('Home-opening-slider');
  }
}

add_action('x_before_view_global__slider-below', 'add_home_slider');

using elseif intead of && it works! I hope this could be useful for someone it has the same needs.

Thanks!

We’re glad you’ve sorted this out, Alessandro. Thanks for sharing.

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