Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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 ?>
share|improve this question
    
You need to spend some time on writing your question, and framing it properly. Please take a relook. :) –  its_me Jul 6 '12 at 14:44

1 Answer 1

up vote 4 down vote accepted

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".

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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