2 out of 2 members found this post helpful.
Numarul de "share-uri" al unui articol pe facebook, twitter si google plus [cod]
Codul de mai jos se include in fisierul single.php (de obicei) si afiseaza de cate ori a fost impartit/"share-uit" un articol pe facebook, twitter si google plus:
Cod:
function social_shares() {
$url = get_permalink( $post_id );
$json = file_get_contents("http://api.sharedcount.com/?url=" .
rawurlencode($url));
$counts = json_decode($json, true);
$totalcounts= $counts["Twitter"] +
$counts["Facebook"]["total_count"] +
$counts["GooglePlusOne"];
echo "<div>$totalcounts Share</div>";
}
Sper sa va fie de folos.
LE: Cine o inventa codurile astea, nu stiu. Codul nu functioneaza, ca mi-e greu sa-l testez inainte... Revin.
Ultima modificare făcută de Bogdan Calin; 8th March 2013 la 18:56.