Changing Share Plugin & Builder Priority

Themify Builder appends its content filtering the post or page content using the_content filter and appending itself. Share plugins like AddThis, ShareThis, Bookmarkify, etc. also use the same method to append content to the post or page. Sometimes they might have conflicts due to their display priority.

Priority is a term used in WordPress actions and filters, and it indicates the order in which the action or filter is executed. Priority goes from 0 to anything. In our particular case with Builder and share plugins, priority will be the order in which these additional contents are appended.

As a reference, Builder appends its content on priority 11, so to add content after Builder's own content, you must use priority 12 or higher.

This tutorial provides sample custom functions to show you how to change the priority of the social buttons so they are added after Builder.

  • create a custom-functions.php file in the theme folder (if it doesn't exist)
  • paste in the following function:

SimpleShareButtons

Reference: http://www.simplesharebuttons.com/wordpress/

<?php
// change priority for SimpleShareButtons
if ( function_exists( 'show_share_buttons' ) ) {
remove_filter( 'the_content', 'show_share_buttons');
add_filter( 'the_content', 'show_share_buttons', 15 );
}
?>

ShareThis

Reference: http://wordpress.org/plugins/share-this/

<?php
// Change priority for ShareThis
if ( function_exists( 'st_add_widget' ) ) {
remove_filter( 'the_content', 'st_add_widget');
add_filter( 'the_content', 'st_add_widget', 15 );
}
?>

Bookmarkify

Reference: http://wordpress.org/plugins/bookmarkify/

<?php
// Change priority for Bookmarkify
if ( function_exists( 'bookmarkifyPost' ) ) {
remove_filter( 'the_content', 'bookmarkifyPost');
add_filter( 'the_content', 'bookmarkifyPost', 15 );
}
?>

Shareaholic

Reference: http://wordpress.org/plugins/bookmarkify/

<?php
// Change priority for Shareaholic
if ( class_exists( 'ShareaholicPublic' ) ) {
remove_action('the_content', array('ShareaholicPublic', 'draw_canvases'));
add_filter('the_content', array('ShareaholicPublic', 'draw_canvases'), 15);
}
?>

JetPack Sharedaddy

Reference: http://jetpack.me/tag/sharedaddy/

<?php
// Change priority for Shareaholic 
remove_filter( 'the_content', 'sharing_display', 19 );
    remove_filter( 'the_excerpt', 'sharing_display', 19 );
    add_filter( 'the_content', 'sharing_display', 10 );
    add_filter( 'the_excerpt', 'sharing_display', 10 );
?>

Celebrating our LUCKY7 Anniversary with a 50% Sale + 7 Lifetime Club Giveaway! Submit entry here