Reputation: 5437
I'm very new to wordpress. I'm developing a wordpress theme and using social share button plugin to share the post on social networking websites. Now all the social buttons are shown just below the post content. but I want them to show on a custom position in the post div.
the plugin button are shown using the following piece of code:
add_filter('the_content', 'ssb_display');
This code shows the social share buttons below post contents but I want them to show on another position in the same post div. How can I do this. Please don't give negative to my question as I'm newbie in wordpress.
Actually i want to define my own filter hook in wordpress then add_filter to that hook.
thanks.
Upvotes: 0
Views: 109
Reputation: 433
Once, you can remove action with this code:
remove_filter('the_content', 'ssb_display');
Now, plugin don't add any code your output. And you can add social buttons to where you want with this code:
if (function_exists('ssb_share_icons'))
echo ssb_share_icons();
Upvotes: 0
Reputation: 1638
The opposite of add_filter
is remove_filter
, and since the callback is registered by a name function you only need to add
// functions.php
remove_filter('the_content', 'ssb_display');
And then display, the button where you want.
Update
If for any reason you can't use ssb_display
function directly in your template, you can use a custom filter with apply_filters
// functions.php
add_filter('show_the_ssb_button', 'ssb_display')
// template.php
<?php echo apply_filters('show_the_ssb_button', $content) ?>
If ssb_display
doesn't use specific info from content, then $content
variable can be an empty string.
Upvotes: 1