Written by Anonymous
function popular_entries_shortcode($atts) {
extract(shortcode_atts(array(
'days' => 'all',
'count' => 5,
'type' => 'default',
'rank' => 0,
'pv' => 0,
'cats' => 'all',
'children' => 0,
'ex_posts' => null,
'ex_cats' => null,
'bold' => 0,
'arrow' => 0,
'date' => 0,
'class' => null,
'snippet' => 0,
'author' => null,
'post_type' => 'post',
'horizontal' => 0,
'action' => null,
'comment' => 0,
'offset' => 0,
), $atts, 'popular_list'));
//countオプションに異常値が入っていた場合
if (!is_numeric($count) || (is_numeric($count) && (intval($count)) <= 0)) {
$count = 5;
}
//表示カテゴリー
$cat_ids = array();
if ($cats && $cats != 'all') {
$cat_ids = explode(',', $cats);
}
//除外投稿
$exclude_post_ids = array();
if ($ex_posts) {
$exclude_post_ids = explode(',', $ex_posts);
}
//除外カテゴリー
$exclude_cat_ids = array();
if ($ex_cats) {
$exclude_cat_ids = explode(',', $ex_cats);
}
$atts = array(
'days' => $days,
'entry_count' => $count,
'entry_type' => $type,
'ranking_visible' => $rank,
'pv_visible' => $pv,
'cat_ids' => $cat_ids,
'children' => $children,
'exclude_post_ids' => $exclude_post_ids,
'exclude_cat_ids' => $exclude_cat_ids,
'bold' => $bold,
'arrow' => $arrow,
'date' => $date,
'class' => $class,
'snippet' => $snippet,
'author' => $author,
'post_type' => $post_type,
'horizontal' => $horizontal,
'action' => $action,
'comment' => $comment,
'offset' => $offset,
);
ob_start();
generate_popular_entries_tag($atts);
$res = change_fa(ob_get_clean());
return $res;
}