Skip to content

Instantly share code, notes, and snippets.

@cazuki
Last active September 2, 2015 05:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cazuki/a15bbdbd7b71a0bc9d20 to your computer and use it in GitHub Desktop.
Save cazuki/a15bbdbd7b71a0bc9d20 to your computer and use it in GitHub Desktop.
SNS Count Cacheのトータルシェア数を使って人気の記事をランダム表示する
<ul>
<?php
$featured = get_posts( array (
'meta_query' => array (array(
'key' => 'scc_share_count_total',
'value' => '200',
'compare' => '>=',
'type' => 'NUMERIC'
)),
'post_status' => 'publish',
'posts_per_page' => 3,
'orderby' => 'rand'
));
foreach($featured as $post):
setup_postdata($post);
?>
<li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
<?php endforeach; wp_reset_postdata(); ?>
</ul>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment