I wanted to say after post and before some plugin like related post, just control the order will appear.
I like also add the url permalink to data-href=”” because in multisite no get the url.
Theme Author
Tom
(@edge22)
Hi there,
You can try hooking it into the generate_after_entry_content hook.
Something like:
function share_this(){
if(!is_feed() && !is_home()) {
echo '<div class="share-this">
<div class="fb-like" data-layout="button_count" data-action="like" data-size="large" data-show-faces="false" data-share="false"></div>
</div>';
}
}
add_action('generate_after_entry_content', 'share_this');
The 2 codes are ok, just is difficult put it in order of display I want. Is one problem of wordpress.
Is possible display in order modifying the plugins and functions with one number at the end: add_action('generate_after_entry_content', 'share_this',1);
The only problem is in multisite, facebook take just the website domain.
I try something how data-href="'. get_permalink(); .'" But give me error.
Thanks
Theme Author
Tom
(@edge22)
Hmm, I’m not sure there’s anything you can do about that.
You need to remove the ; after get_permalink().
; should only be at the end of the line.
This run and maybe can be useful to others. The last number is the order display 1 for put after the post, can be 10 to put it before comments.
function share_this($content){
if(!is_feed() && !is_home()) {
$content .= '<div style="margin-top:1em">
<div class="fb-like" data-layout="button_count" data-href="'. get_permalink() .'" data-action="like" data-size="large" data-show-faces="false" data-share="false"></div>
</div>';
}
return $content;
}
add_action('the_content', 'share_this', 1);
The plugins use the iframe version but not is responsive with 450px width.
Theme Author
Tom
(@edge22)
Awesome! 🙂
Thanks for sharing your working code.