Show Slider on Front Page Only

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #4670 Reply
    Jean-Claude
    Guest

    I am not sure if that’s a reasonable question but I have never seen a website with the slider being on the Front page but also on the post or news page. How can I get the slider to only display on the front page??
    In the Frontier Options, it says it will display on both the front and posts pages but I do not want that to be the case. I only want the slider on the front.

    #4673
    Ron
    Keymaster

    You can add this on a child-theme’s functions.php

    function remove_default_slider() {
    	remove_action( 'frontier_before_main', 'frontier_slider_on_main' );
    	remove_action( 'frontier_before_content', 'frontier_slider_on_content' );
    }
    add_action( 'after_setup_theme', 'remove_default_slider', 11 );
    function slider_on_front_page() {
    	if ( is_front_page() ) {
    	     echo '<div id="slider" class="slider-content">';
    	     get_template_part('slider');
    	     echo '</div>';
    	}
    }
    add_action( 'frontier_before_content', 'slider_on_front_page' );
    #4701
    Joe McD
    Guest

    Ron, thank you for this code. It worked perfectly on my site.

Viewing 3 posts - 1 through 3 (of 3 total)
Reply To: Show Slider on Front Page Only
Your information: