Loading plugin script only on required page?

by DDulla   Last Updated October 09, 2019 15:08 PM - source

I have a plugin that is loading its .js on every page on my site.

I was able to filter out the plugin from loading, but i can't figure out how to specify the pages on which to load.

Plugin Code:

function A2A_SHARE_SAVE_head_script() {
     add_filter( 'addtoany_script_disabled', '__return_true' );
     $script_disabled = apply_filters( 'addtoany_script_disabled', false );

I need to be able to en queue the script on blog single post pages, the page template looks like this:

<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<?php get_template_part( 'entry' ); ?>
<?php endwhile; endif; ?>

And then in entry.php i manually call the plugin as follows:

<?php if ( function_exists( 'social_sharing_buttons' ) ) { social_sharing_buttons(); } ?>

Related Questions

daily cost changing plugin

Updated September 30, 2018 14:08 PM

how to make wordpress remember my choice

Updated September 01, 2017 17:08 PM