Baguje.COM

[WordPress] Kako da automatski dodate Twitter i Facebook share dugmiće ispod vašeg posta

Evo jedan mali, kratak i brz trik za sve blogere koji koriste WordPress platformu za blogovanje. Sve što treba da uradite da biste dodali Twitter i Facebook share dugmiće odmah ispod teksta vašeg posta je da dodate sledeći kod u vaš functions.php fajl u /wp-content/themes/TEMA/ direktorijumu (ukoliko fajl ne postoji, napravite ga):

Kod

[php]
function share_this($content){
if(!is_feed() && !is_home()) {
$content .= ‘<div class="share-this">
<a href="http://twitter.com/share"
class="twitter-share-button"
data-count="horizontal">Tweet</a>
<script type="text/javascript"
src="http://platform.twitter.com/widgets.js">
<div class="facebook-share-button">
<iframe
src="http://www.facebook.com/plugins/like.php?href=’.
urlencode(get_permalink($post->ID))
.’&amp;layout=button_count&amp;show_faces=false&amp;width=200&amp;action=like&amp;colorscheme=light&amp;height=21"
scrolling="no" frameborder="0" style="border:none;
overflow:hidden; width:200px; height:21px;"
allowTransparency="true"></iframe>
</div>
</div>’;
}
return $content;
}
add_action(‘the_content’, ‘share_this’);
[/php]

Exit mobile version