// } if (get_the_ID() == $dp->ID) { continue; } $counter++; if ($counter > 6) { break; } $item = get_post($dp->ID); ?> <li><a href="<?php echo get_permalink($item->ID); ?> "> <?php if (check_in_week($item->post_date)) { echo '<span class="entryMark">new</span>'; } ?> <div class="pic"><?php echo get_the_post_thumbnail($item->ID, 'hotdaily-thumb'); ?> </div> <h2><?php echo $item->post_title; ?> </h2> <p class="txt"><?php // split content if too long echo wp_html_excerpt($item->post_content, 35, ' ...'); ?>
// $GLOBALS['DebugMyPlugin']->panels['main']->addPR('recommended query:',$the_query,__FILE__,__LINE__ ); // The Loop ?> <?php if ($the_query->have_posts()) { ?> <?php while ($the_query->have_posts()) { $the_query->the_post(); ?> <section> <a href="<?php echo get_permalink(); ?> "><?php if (check_in_week(get_the_date("Y/m/d"))) { echo '<span class="entryMark">new</span>'; } ?> <div class="pic"><?php the_post_thumbnail(array(245, 163)); ?> </div> <h1><?php the_title(); ?> </h1> <p> <?php the_excerpt(); ?> </p>
function all_category_page() { $healthCat = get_category_by_slug('health'); $cosmeCat = get_category_by_slug('cosme'); $troubleCat = get_category_by_slug('trouble'); $componentCat = get_category_by_slug('component'); $paged = get_query_var('paged') ? get_query_var('paged') : 1; $args = array('paged' => $paged); global $wp_query; $tmp_query = $wp_query; query_posts($args); // fix for more tag in page global $more; $more = 0; ?> <?php if (have_posts()) { ?> <section class="entryList"> <?php while (have_posts()) { the_post(); ?> <article class="entryPiece"> <a href="<?php the_permalink(); ?> "> <header class="entryHeader"> <div class="entryInfo"> <span class="entryDate"><?php echo get_the_date("Y/m/d"); ?> </span> <?php if (check_in_week(get_the_date("Y/m/d"))) { echo '<span class="entryMark">new</span>'; } ?> </div> <!--//.entryInfo--> <h1><?php the_title(); ?> </h1> </header> <div class="entryOverview"> <div class="pic"> <?php the_post_thumbnail('avatar-thumb'); ?> </div> <div class="txt"> <?php $category = get_the_category(); $color = ""; foreach ($category as $key => $cat) { if ($cosmeCat->cat_ID == $cat->cat_ID || cat_is_ancestor_of($cosmeCat->cat_ID, $cat->cat_ID)) { $color = "yellow"; } elseif ($troubleCat->cat_ID == $cat->cat_ID || cat_is_ancestor_of($troubleCat->cat_ID, $cat->cat_ID)) { $color = "blue"; } elseif ($componentCat->cat_ID == $cat->cat_ID || cat_is_ancestor_of($componentCat->cat_ID, $cat->cat_ID)) { $color = "purple"; } } ?> <div class="tagMark <?php echo $color; ?> "><div><span><?php if (isset($category[0])) { echo $category[0]->cat_name; } ?> </span></div></div> <?php the_content('', FALSE, ''); ?> <div class="viewMore"><span>続きを見る</span></div> </div> </div> <!--//.entryOverview--> </a></article> <?php } ?> </section> <?php // Don't print empty markup if there's only one page. if ($wp_query->max_num_pages >= 2) { if (function_exists('wp_paginate')) { echo '<div class="pagination">'; wp_paginate(); $current_page = isset($wp_query->query['paged']) ? $wp_query->query['paged'] : 1; $total_items = $wp_query->found_posts; $items_per_page = $wp_query->query_vars['posts_per_page']; $from = ($current_page - 1) * $items_per_page + 1; $to = $current_page == $wp_query->max_num_pages ? $total_items : $current_page * $items_per_page; echo '<p class="status">' . $total_items . '件中 ' . $from . ' - ' . $to . ' を表示</p>'; echo '</div>'; } elseif (function_exists('wp_pagenavi')) { wp_pagenavi(); } else { $big = 999999999; // need an unlikely integer echo paginate_links(array('base' => str_replace($big, '%#%', esc_url(get_pagenum_link($big))), 'format' => '?paged=%#%', 'current' => max(1, get_query_var('paged')), 'total' => $wp_query->max_num_pages)); } } } $wp_query = $tmp_query; }