Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #19177
    jp_grennier
    Member

    Hello,

    My site is http://jpgrennier.com. Sakin was helping me a couple of months ago and I’m just now attempting to finish the site. I now have a custom (Slide Deck) slider working nicely, however it is on every page and I’d like this to only appear on the homepage. I’m sorry but my php skills are presently lacking. Here is my child theme functions.php:

    <?php
    // Removing the Default Slider
    function unhook_catcheverest_functions() {
    
    	remove_action( 'catcheverest_before_main', 'catcheverest_slider_display', 10 );
    }
    add_action( 'init', 'unhook_catcheverest_functions' );
    
    // Adding New Slider Code
    function catcheverest_child_slider() {
    echo '<div id="main-slider" class="container">';
    	//Add in your code in betwwen this bracket
    	echo do_shortcode( '[SlideDeck2 id=281 ress=1]' );
    echo '</div>';
    	
    }
    add_action( 'catcheverest_before_main', 'catcheverest_child_slider', 10 );

    Thanks again, the support on this theme has been fantastic so far!

    jpg

    #19183
    Sakin
    Keymaster

    @jp_grennier: Can you try this

    <?php
    // Removing the Default Slider
    function unhook_catcheverest_functions() {
    
    	remove_action( 'catcheverest_before_main', 'catcheverest_slider_display', 10 );
    }
    add_action( 'init', 'unhook_catcheverest_functions' );
    
    // Adding New Slider Code
    function catcheverest_child_slider() {
    	if ( is_home() ) {	
    	echo '<div id="main-slider" class="container">';
    		//Add in your code in betwwen this bracket
    		echo do_shortcode( '[SlideDeck2 id=281 ress=1]' );
    	echo '</div>';
    	}
    }
    add_action( 'catcheverest_before_main', 'catcheverest_child_slider', 10 );
    #19305
    jp_grennier
    Member

    For some reason the above code also removes Slide Deck from the homepage and breaks my favicon. Is there another way to go about it? Thanks again!

    jpg
    http://jpgrennier.com

    #19312
    Sakin
    Keymaster

    @jp_grennier: I can see your Favicon. But yes, I see that the Slide Desk has been removed from Homepage and showing only in Blog page. I think you have Set static page in your “Settings => Reading”. In this case, you code will be as below:

    <?php
    // Removing the Default Slider
    function unhook_catcheverest_functions() {
    	remove_action( 'catcheverest_before_main', 'catcheverest_slider_display', 10 );
    }
    add_action( 'init', 'unhook_catcheverest_functions' );
    
    // Adding New Slider Code
    function catcheverest_child_slider() {
    	if ( is_front_page() ) {	
    	echo '<div id="main-slider" class="container">';
    		//Add in your code in betwwen this bracket
    		echo do_shortcode( '[SlideDeck2 id=281 ress=1]' );
    	echo '</div>';
    	}
    }
    add_action( 'catcheverest_before_main', 'catcheverest_child_slider', 10 );
    #19420
    jp_grennier
    Member

    Thank you Sakin, this worked!

    jpg

    #20830
    jp_grennier
    Member

    Any idea why on this page there is margin or padding above the slider?

    http://jpgrennier.com/140-pm-test/

    I can’t seem to find it…thanks!

    jpg

    #20836
    Sakin
    Keymaster

    @jp_grennier: That is issue with the slider position in the code. So, you can add the following CSS in “Appearance => Theme Options => Custom CSS” box to remove it.

    .page-id-382 #main { padding-top: 0; }
    .page-id-382 article .entry-header { display: none; }
    #20853
    jp_grennier
    Member

    This also worked – thanks again.

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘Removing custom slider from pages’ is closed to new replies.