スニペット/WordPress Popular Posts
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | <?php function custom_popular_post($post_html, $p, $instance) { $img = get_the_post_thumbnail ($p->id); $release = get_field ('release', $p->id); $price = get_field ('price', $p->id); $child_cat = @custom_get_the_child_categories(9, $p->id); $child_cat_dc = @custom_get_the_child_categories(226, $p->id); $child_cat_site = @custom_get_the_child_categories(10, $p->id); if (is_front_page()) { $output = '<li class="inner-opus"> <a href="'. get_the_permalink ($p->id) .'"><dl> <dt>'. $img .'<b class="ic"><small class="ic-genre '. $child_cat[0]->slug .'">'. $child_cat[0]->name .'</small><small style="margin-left: -8px;" class="ic-genre '. $child_cat_dc[0]->slug .'">'. $child_cat_dc[0]->name .'</small><small class="ic-genre site">'. $child_cat_site[0]->name .'</small></b></dt> <dd>'. $p->title .'</dd> </dl></a> <p><time>配信日:'. $release .'</time> 販売価格:'. $price .'円~</p> </li>'; } elseif (is_page('tt') || is_page('hh')) { $output = '<li> <a href="'. get_the_permalink ($p->id) .'"><dl> <dt>'. $img .'<b class="ic"><small class="ic-genre ic-genre-page '. $child_cat[0]->slug .'">'. $child_cat[0]->name .'</small><small style="margin-left: -8px;" class="ic-genre ic-genre-page '. $child_cat_dc[0]->slug .'">'. $child_cat_dc[0]->name .'</small><small class="ic-genre ic-genre-page site">'. $child_cat_site[0]->name .'</small></b></dt> <dd>'. $p->title .'</dd> </dl></a> <span><time>配信日:'. $release .'</time> 販売価格:$'. $price .'~</span> </li>'; } elseif (is_page('dd')) { $output = '<li> <a href="'. get_the_permalink ($p->id) .'"><dl> <dt>'. $img .'<b class="ic"><small class="ic-genre ic-genre-page '. $child_cat_dc[0]->slug .'">'. $child_cat_dc[0]->name .'</small></b></dt> <dd>'. $p->title .'</dd> </dl></a> <span><time>配信日:'. $release .'</time> 販売価格:'. $price .'円~</span> </li>'; } else { // elseif (is_page()) { $output = '<li> <a href="'. get_the_permalink ($p->id) .'"><dl> <dt>'. $img .'<b class="ic"><small class="ic-genre ic-genre-page '. $child_cat[0]->slug .'">'. $child_cat[0]->name .'</small><small style="margin-left: -8px;" class="ic-genre ic-genre-page '. $child_cat_dc[0]->slug .'">'. $child_cat_dc[0]->name .'</small><small class="ic-genre ic-genre-page site">'. $child_cat_site[0]->name .'</small></b></dt> <dd>'. $p->title .'</dd> </dl></a> <span><time>配信日:'. $release .'</time> 販売価格:'. $price .'円~</span> </li>'; } return $output; } add_filter ('wpp_post', 'custom_popular_post', 10, 3); ?> |
1 2 3 4 5 6 7 8 9 10 | <?php $wpp = array( 'cat' => 2083, 'limit' => 3, 'post_type' => 'post', 'range' => 'weekly', // daily, weekly, monthly 'stats_comments' => '0', // コメント数非表示 'stats_views' => '0', // 閲覧数非表示 ); ?> <?php wpp_get_mostpopular($wpp); ?> |
コメントを投稿する