jaredatch / EA-Share-Count

A lean plugin that leverages SharedCount.com API to quickly retrieve, cache, and display various social sharing counts.
84 stars 13 forks source link

Add filter for modifying wrapping class #75

Closed billerickson closed 7 years ago

billerickson commented 7 years ago

Add filter here: https://github.com/jaredatch/EA-Share-Count/blob/master/includes/class-front.php#L256

See: https://twitter.com/jivedig/status/795698490059976708

entr commented 7 years ago

Ideally this should be a filterable sprintf() format I think like:

$links = apply_filters( 'ea_share_count_display', $services, $location );
$wrap_format = apply_filters( 'ea_share_count_display_wrap_format', '<div class="ea-share-count-wrap %2$s">%1$s</div>', $location );
$output = sprintf( $wrap_format, $links, sanitize_html_class( $location ) );

And probably an extra filter on $output while we on the subject. I could send a PR if everyone is happy with that.

JiveDig commented 7 years ago

I'm cool with that... actually i originally thought I could make it work with ea_share_count_display as-is... but couldn't. I love the filters on the links themselves, but your solution would make it much more flexible. I'm trying to add flexbox support via https://github.com/JiveDig/flexington, but the same would apply for people using bootstrap or other. Good to go from here ;) Thanks.

billerickson commented 7 years ago

See 53de137b94f32bb9bb4e22393d83c55ab7ae199f