Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $query = new WP_Query(array('posts_per_page'=>-1));
- $sort_tab = array();
- while ($query->have_posts()) : $query->the_post();
- if ( has_post_thumbnail() ) {
- the_post_thumbnail( array(40,40) );
- }
- $url = get_the_permalink();
- $json = file_get_contents( 'https://graph.facebook.com/fql?q=SELECT%20like_count,%20total_count,%20share_count,%20click_count,%20comment_count%20FROM%20link_stat%20WHERE%20url%20=%20%27' . $url . '%27' );
- $json_data = json_decode($json, false);
- $sort_tab[$json_data->data[0]->total_count] = $url;
- endwhile;
- wp_reset_query();
- sort($sort_tab);
- foreach($sort_tab as $count=>$link)
- {
- echo $link.' has '.$count.' votes <br>';
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement