Loading plugin script only on required page?

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(); } ?>

Read more here:: Loading plugin script only on required page?

Leave a Reply

Your email address will not be published. Required fields are marked *