I wondered how to place Jetpack’s/Sharedaddy’s sharing functionality where I like and only where I like.
The automatic placement is triggered by two filter adds within the code of the plugin (within ‘sharing-service.php’).
In order to override this in a specific loop it is necessary to remove these filters right before the content tag. Code then should look like this:
<?php remove_filter( 'the_content', 'sharing_display', 19 ); ?> <?php remove_filter( 'the_excerpt', 'sharing_display', 19 ); ?> <?php the_content(); ?>
Then just add the tag
<?php echo sharing_display(); ?>wherever you like, but of course within the loop.
I found a solution suggesting to remove the two adds from the plugin code. But my solution has two big advantages:
- First, it survives plugin updates. Caveat: The respective code stays unchanged => this should be checked after each update.
- Secondly, you still have the possibility of automatic sharing placement in each loop you do not modify this way.
- The topic ‘Custom Placement of Jetpack's/Sharedaddy's Sharing’ is closed to new replies.