Skip to content

Commit

Permalink
- Hide Total Counts button if empty and "Hide Empty Counts" setting i…
Browse files Browse the repository at this point in the history
…s enabled, closes #44
  • Loading branch information
jaredatch committed Apr 18, 2019
1 parent 0170abd commit a7bd220
Show file tree
Hide file tree
Showing 4 changed files with 142 additions and 130 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ All notable changes to this project will be documented in this file, formatted v
- Pass post_id to `needs_updating` method.
- Removed support for Google+ and StumbleUpon (RIP).
- Default `letter-spacing` to normal on button labels.
- Hide Total Counts button if empty and "Hide Empty Counts" setting is enabled.

### Fixed
- Pinterest JS API conflict.
Expand Down
6 changes: 6 additions & 0 deletions includes/class-shared-counts-front.php
Original file line number Diff line number Diff line change
Expand Up @@ -647,6 +647,12 @@ public function link( $types = 'facebook', $id = false, $echo = true, $style = '
$show_count = false;
}

// Hide Total Counts button if empty and "Hide Empty Counts" setting
// is enabled.
if ( 'included_total' === $type && 0 === absint( $link['count'] ) && 'false' === $show_empty ) {
continue;
}

// Build button output.
if ( 'included_total' === $type ) {
$elements['wrap_open'] = sprintf(
Expand Down
Loading

0 comments on commit a7bd220

Please sign in to comment.