WordPress.org

Ready to get started?Download WordPress

Forums

Infinite-Scroll
How to disable plugin on certain pages? (5 posts)

  1. Sjourney
    Member
    Posted 2 years ago #

    Since according to the FAQ Infinite Scroll is not fully supported to use on archive, tag, category pages... then is there a way to disable it on those pages?
    Using an is_search() for example

    http://wordpress.org/extend/plugins/infinite-scroll/

  2. Sjourney
    Member
    Posted 2 years ago #

    Was hoping this would help, but it hasn't. Any ideas?

    /*  Remove Infinite Scroll javascript from every page except Frontpage
            ================================================================== */
            add_action( 'wp_print_scripts', 'deregister_infinite_scroll_javascript', 100 );
            function deregister_infinite_scroll_javascript() {
                if ( is_search() ) {
                    wp_deregister_script( 'infinite-scroll' );
                }
            }   
    
            /* Remove Easing Slider CSS from every page except Frontpage
            ================================================================== */
            add_action( 'wp_print_styles', 'deregister_infinite_scroll_styles', 100 );
            function deregister_infinite_scroll_styles() {
                if ( is_search() ) {
                    wp_deregister_style( 'infinite-scroll' );
                }
            }
  3. Sjourney
    Member
    Posted 2 years ago #

    Getting closer! but not there yet.

    /*  Remove Infinite Scroll javascript Search page
            ================================================================== */
            add_action( 'wp_print_scripts', 'deregister_infinite_scroll_javascript', 100 );
            function deregister_infinite_scroll_javascript() {
                if ( is_search() ) {
                    wp_deregister_script( 'infinite-scroll-init' );
                }
            }   
    
            /* Remove Easing Slider CSS from Search page
            ================================================================== */
            add_action( 'wp_print_styles', 'deregister_infinite_scroll_styles', 100 );
            function deregister_infinite_scroll_styles() {
                if ( is_search() ) {
                    wp_deregister_style( 'infinite-scroll-init' );
                }
            }
  4. Sjourney
    Member
    Posted 2 years ago #

    Getting warmer:
    This one removes the plugin from search, category pages and tag pages

    /*  Remove Infinite Scroll javascript from Search, Category, Tag Pages
            ================================================================== */
            add_action( 'wp_print_scripts', 'deregister_infinite_scroll_javascript', 100 );
            function deregister_infinite_scroll_javascript() {
                if ( is_search() || is_category() || is_tag()  ) {
                    wp_deregister_script( 'infinite-scroll-init' );
                    wp_deregister_script( 'infinite-scroll-admin' );
                }
            }   
    
            /* Remove Infinite Scroll CSS from Search, Category, Tag Pages
            ================================================================== */
            add_action( 'wp_print_styles', 'deregister_infinite_scroll_styles', 100 );
            function deregister_infinite_scroll_styles() {
                if ( is_search() || is_category() || is_tag()  ) {
                    wp_deregister_style( 'infinite-scroll-init' );
                    wp_deregister_style( 'infinite-scroll-admin-style' );
                }
            }
  5. Sjourney
    Member
    Posted 2 years ago #

    I still see some inline CSS styling creeping in to the pages where I've deregistered the plugin. Anyone have any ideas how to stop this?

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.