• Hi,
    I have a question about loading files only on one page, not on the whole website. Is it possible to load js/CSS files only on one page where I put my search?
    Regards,
    Jovan

    • This topic was modified 3 years, 3 months ago by jovan996.
Viewing 1 replies (of 1 total)
  • Plugin Author wpdreams

    (@wpdreams)

    Hi,

    Well, there are no visual options for this in the Lite version as this is a Pro version feature, but there is a programmatical way to stop the plugin from loading if criteria is not met using the asl_stop_loading hook.

    add_filter( 'asl_stop_loading', 'asl_stop_loading_on', 10, 1 );
    function asl_stop_loading_on( $results ) {
    	global $post;
    	// Allow plugin only on post ID = 123
    	if ( isset($post->ID) && $post->ID == 123 ) {
    		return false;
    	}
    	
    	return true;
    }

    Whenever this function returns true the plugin stops before loading, and loads when returns false;

    Best,
    Ernest M.

Viewing 1 replies (of 1 total)
  • The topic ‘Load files only on one page’ is closed to new replies.