Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Chris Marslender

    (@cmmarslender)

    There is a filter that allows you to control whether the plugin should be active for certain pages of the site enss-enabled – You could return false on this by default, and then only return true for the certain pages you want it enabled on

    add_filter( 'enss-enabled', '__return_false' );

    Then, for the page template you want it enabled on, you could do this:

    add_filter( 'enss-enabled', '__return_true' );

    put this in your header. This example only displays SS on the home page. use conditional tags to customise it

    <?php if ( !is_front_page() ) : ?>
    	<style>
    	#supersized {
    		display: none;
    	}
    	</style>
    	<?php endif; ?>

    Plugin Author Chris Marslender

    (@cmmarslender)

    dvize – That works, but only visually – There is also a filter availale “enss-enabled” that will completely prevent the markup from being output in the first place, so will be easier on things like page weight / client side rendering efforts – Using your example above, if you wanted to only display this on the front page, you could do something like this in your functions.php file

    function myprefix_filter_supersized( $enabled ) {
        // Lets start with a known enabled state - Should be default anyways
        $enabled = true;    
    
        if ( ! is_front_page() ) {
            $enabled = false;
        }
    
        return $enabled;
    }
    add_filter( 'enss-enabled', 'myprefix_filter_supersized' );
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘how can I use it on one template page only’ is closed to new replies.