Skip to content
Browse files

Twenty Fourteen: Let's not add sharing options to the post in the first

place, rather than removing it after the fact.
  • Loading branch information...
1 parent 6185199 commit 341f00f25673e69f88d01878b7d1a77ed595a21d @obenland obenland committed Dec 18, 2013
Showing with 10 additions and 10 deletions.
  1. +10 −10 modules/theme-tools/compat/twentyfourteen.php
View
20 modules/theme-tools/compat/twentyfourteen.php
@@ -40,18 +40,18 @@ function twentyfourteen_featured_content_default_settings( $settings ) {
add_action( 'featured_content_default_settings', 'twentyfourteen_featured_content_default_settings' );
/**
- * Removes post flair markup from post content if we're not in the loop and
- * it's a formatted post.
+ * Removes sharing markup from post content if we're not in the loop and it's a
+ * formatted post.
*
- * @param string $content
- * @return string
+ * @param bool $show Whether to show sharing options.
+ * @param WP_Post $post The post to share.
+ * @return bool
*/
-function twentyfourteen_mute_content_filters( $content ) {
+function twentyfourteen_mute_content_filters( $show, $post ) {
$formats = get_theme_support( 'post-formats' );
- if ( ! in_the_loop() && has_post_format( $formats[0] ) ) {
- $parts = explode( '<div id="jp-post-flair"', $content );
- $content = $parts[0];
+ if ( ! in_the_loop() && has_post_format( $formats[0], $post ) ) {
+ $show = false;
}
- return $content;
+ return $show;
}
-add_filter( 'the_content', 'twentyfourteen_mute_content_filters', 9999 );
+add_filter( 'sharing_show', 'twentyfourteen_mute_content_filters', 10, 2 );

2 comments on commit 341f00f

@nb
Automattic member
nb commented on 341f00f Dec 19, 2013

@obenland it’s customary that git commits are in specific format: a 50-chars or less summary, empty line, then 72-characters-wrapped description.

As you can see on this page, Github breaks the subject line at some point.

@obenland

That does look odd. Thanks for the heads up!

Please sign in to comment.
Something went wrong with that request. Please try again.