Forums

[resolved] [Plugin: Frontpage-Slideshow] Disable required frameworks on other pages tha the front one (7 posts)

  1. h-a-r-v
    Member
    Posted 2 years ago #

    I've already mentioned that btw. in the other thread.

    I DON'T WANT prototype.js and wp-scriptaculous.js to be included on pages other than the front page (where the slideshow is used), because it messes with a mootools plugin I'm using there (disabling it from working).

    How can I do that?

    I guess it should be done by default.

    Thanks for help in advance,
    Kind regards

  2. h-a-r-v
    Member
    Posted 2 years ago #

    I tried this, but something goes wrong (doesn't work ;) :

    function frontpageSlideshow_init() {
    	// loads the needed frameworks to load as a safe way
    	if ( is_page(2) ) :
    		wp_enqueue_script('scriptaculous-effects'); // will load PrototypeJS ans Scriptaculous + Scriptaculous Effects
    	endif;
    }
  3. @mercime
    Member
    Posted 2 years ago #

  4. h-a-r-v
    Member
    Posted 2 years ago #

    I suck at php, I know, but this one doesn't work neither (while I guess it should):

    function frontpageSlideshow_init() {
                   if ( is_front_page()  ) {    
    
                   wp_enqueue_script('scriptaculous-effects');
                               }
    }

    edit:

    Thanks mercime, I'll have a look at it.

  5. h-a-r-v
    Member
    Posted 2 years ago #

    Alrite, adding this to your functions.php actually works:

    <?php
    add_action( 'wp_print_scripts', 'my_deregister_javascript', 100 );
    
    function my_deregister_javascript() {
    	if (is_front_page() == 0) {
    	wp_deregister_script( 'scriptaculous-effects' );
    	}
    }
    ?>

    Thanks again.

    My work is done soon here.

  6. @mercime
    Member
    Posted 2 years ago #

    Cheers :-)

  7. jeff_
    Member
    Posted 2 years ago #

    Why dont you use the front-page way to include the slideshow ?

Topic Closed

This topic has been closed to new replies.

About this Topic