0

I use the ALO EasyMail Newsletter.
But the plugin is loading lots of Javascript in the head.

I have a mobile site and the scripts are loading in all the pages. I think this affects the mobile performance and want to load it only on the newsletter pages.

How can i do that and load it only in the /nieuwsbrief page?

The php starts with:

<script type="text/javascript">
//<![CDATA[
<?php if ( is_user_logged_in() ) { // if logged in ?>
1
  • You need to spend some time on writing your question, and framing it properly. Please take a relook. :)
    – its_me
    Commented Jul 6, 2012 at 14:44

1 Answer 1

4

Drop this in your functions.php or a custom plugin.

function wpse_57621_alo_tidy()
{
    if ( $page_id = get_option( 'alo_em_subsc_page' ) ) {
        if ( ! is_page( $page_id ) )
            remove_action( 'wp_head', 'alo_em_ajax_js' );
    }
}
add_action( 'wp', 'wpse_57621_alo_tidy' );

It's attached to the wp hook, which runs just after the request has been handled & queried.

We're saying "if the ALO newsletter page setting exists, but we're not currently on said page, unattach the script output hook".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.