Slider on single post

I searched for and found a solution to adding a slider to a single post by adding the code below to my functions.php in my child theme and it works great. The only issue is that it is above the masthead and need ti below. Can you help?

Thank you in advance for your assistance.

/**
Add a custom slider on top of the single posts page
*/
function custom_slider() { 
 if ( is_single () ) : ?>
  <div class="custom-slider">
    <?php echo do_shortcode( '[rev_slider alias="evergyed-subpage-header"]' ); ?>
  </div>
  <?php endif; 
}
add_action('x_after_site_begin','custom_slider', 30);

Hello Keith,

Thanks for writing in!

If you are using the X theme, you should make use of this code to display the slider below the masthead:

/**
Add a custom slider on top of the single posts page
*/
function custom_slider() { 
 if ( is_single () ) : ?>
  <div class="custom-slider">
    <?php echo do_shortcode( '[rev_slider alias="evergyed-subpage-header"]' ); ?>
  </div>
  <?php endif; 
}
add_action('x_after_view_global__slider-below','custom_slider', 30);

And if you are using Pro theme, you use this:

/**
Add a custom slider on top of the single posts page
*/
function custom_slider() { 
 if ( is_single () ) : ?>
  <div class="custom-slider">
    <?php echo do_shortcode( '[rev_slider alias="evergyed-subpage-header"]' ); ?>
  </div>
  <?php endif; 
}
add_action('x_after_masthead_end','custom_slider', 30);

We would love to know if this has worked for you. Thank you.

Worked famously. Thank you!

You are most welcome. :slight_smile:

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