WordPress.org

Plugin Directory

Changeset 631532


Ignore:
Timestamp:
11/29/12 00:43:05 (17 months ago)
Author:
ethitter
Message:

Jetpack Infinite Scroll compatibility with VideoPress

To prevent JS errors resulting from VideoPress object not existing when called, always load the VideoPress scripts when the plugin is active.

Location:
jetpack/trunk/modules
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • jetpack/trunk/modules/infinite-scroll.php

    r627214 r631532  
    4646 
    4747        add_filter( 'infinite_scroll_js_settings', array( $this, 'filter_infinite_scroll_js_settings' ) ); 
     48 
     49        add_action( 'wp_enqueue_scripts', array( $this, 'action_wp_enqueue_scripts' ) ); 
    4850    } 
    4951 
     
    168170        return $settings; 
    169171    } 
     172 
     173    /** 
     174     * Load VideoPress scripts if plugin is active. 
     175     * 
     176     * @global $videopress 
     177     * @action wp_enqueue_scripts 
     178     * @return null 
     179     */ 
     180    public function action_wp_enqueue_scripts() { 
     181        global $videopress; 
     182        if ( ! empty( $videopress ) && The_Neverending_Home_Page::archive_supports_infinity() && is_a( $videopress, 'VideoPress' ) && method_exists( $videopress, 'enqueue_scripts' ) ) 
     183            $videopress->enqueue_scripts(); 
     184    } 
    170185} 
    171186Jetpack_Infinite_Scroll_Extras::instance(); 
  • jetpack/trunk/modules/infinite-scroll/infinity.php

    r627214 r631532  
    785785     */ 
    786786    function render() { 
    787         while( have_posts() ) { 
     787        while ( have_posts() ) { 
    788788            the_post(); 
    789789 
     
    795795     * Allow plugins to filter what archives Infinite Scroll supports 
    796796     * 
    797      * @uses apply_filters, is_home, is_archive, self::get_settings 
     797     * @uses apply_filters, current_theme_supports, is_home, is_archive, self::get_settings 
    798798     * @return bool 
    799799     */ 
    800     private function archive_supports_infinity() { 
    801         return (bool) apply_filters( 'infinite_scroll_archive_supported', ( is_home() || is_archive() ), self::get_settings() ); 
     800    public function archive_supports_infinity() { 
     801        return (bool) apply_filters( 'infinite_scroll_archive_supported', current_theme_supports( 'infinite-scroll' ) && ( is_home() || is_archive() ), self::get_settings() ); 
    802802    } 
    803803 
Note: See TracChangeset for help on using the changeset viewer.