Add Revolution Slider above masthead for posts, also

Hello! I would like to add a slider above the masthead on posts, too! The option is there for pages. From a 2016 support topic I have tried adding:

<?php if ( is_page( ) ) :?> <?php echo do_shortcode('[rev_slider alias="top"]'); ?> <?php else : ?> <?php x_get_view( 'global', '_slider-above' ); ?> <?php endif; ?>

to the wp-header for my child-theme (I am pretty sure it is the correct folder and file since I can break the site with broken code) but it does not grab the slider. Thank you!

Hi,

We could try using hooks, please remove the file then add the code below in your child theme’s functions.php file

// Add My Slider
// =============================================================================
function add_my_slider(){ 
    if(is_singular('post')) {
        echo do_shortcode('[rev_slider alias="top"]'); 
    }
}
add_action('x_before_view_global__slider-above', 'add_my_slider');

https://theme.co/apex/forum/t/customizations-actions-and-filters-in-x/208

Hope that helps

1 Like

This worked, thank you very much!

You’re welcome! :slight_smile:

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