Skip to content

Commit

Permalink
Fixes #40 issue with jQuery not loading properly under some circumsta…
Browse files Browse the repository at this point in the history
…nces
  • Loading branch information
cabrerahector committed Sep 15, 2014
1 parent a466aa2 commit d720976
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions wordpress-popular-posts.php
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ public function __construct() {
// Register site styles and scripts
if ( $this->user_settings['tools']['css'] )
add_action( 'wp_enqueue_scripts', array( $this, 'register_widget_styles' ) );
add_action( 'wp_enqueue_scripts', array( $this, 'register_widget_scripts' ) );

// Add plugin settings link
add_filter( 'plugin_action_links', array( $this, 'add_plugin_settings_link' ), 10, 2 );
Expand Down Expand Up @@ -656,6 +657,13 @@ public function register_widget_styles() {
}

} // end register_widget_styles

/**
* Registers and enqueues widget-specific scripts.
*/
public function register_widget_scripts() {
wp_enqueue_script( 'jquery' );
} // end register_widget_scripts

/**
* Register the administration menu for this plugin into the WordPress Dashboard menu.
Expand Down Expand Up @@ -1151,9 +1159,6 @@ public function update_views_ajax(){
*/
public function print_ajax(){

wp_print_scripts('jquery');

//if ( !is_singular() || is_attachment() || is_front_page() || is_preview() || is_trackback() || is_feed() || is_robots() || $this->__is_bot() )
if ( (is_single() || is_page()) && !is_front_page() && !is_preview() && !is_trackback() && !is_feed() && !is_robots() ) {

global $post;
Expand Down

0 comments on commit d720976

Please sign in to comment.