Skip to content

Commit

Permalink
gravatar-hovercards: Only load when gravatars are on the page
Browse files Browse the repository at this point in the history
  • Loading branch information
dero committed Mar 8, 2020
1 parent 35c35c5 commit 72ab5be
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions modules/gravatar-hovercards.php
Original file line number Diff line number Diff line change
Expand Up @@ -213,14 +213,22 @@ function grofiles_admin_cards() {
}

function grofiles_extra_data() {
$authors = grofiles_gravatars_to_append();

if ( ! $authors ) {
wp_dequeue_script( 'grofiles-cards' );
wp_dequeue_script( 'wpgroho' );
} else {
?>
<div style="display:none">
<?php
foreach ( grofiles_gravatars_to_append() as $author )
grofiles_hovercards_data_html( $author );
foreach ( $authors as $author ) {
grofiles_hovercards_data_html( $author );
}
?>
</div>
<?php
}
}

/**
Expand Down

0 comments on commit 72ab5be

Please sign in to comment.