File: /virtual/nagasaki/public_html/shop/wp-content/themes/riffles_ver1.1/front-page.php
<?php
/**
* @package Riffles
* @link http://www.u-hg.com/
* @author RiffleHatch
* @copyright Copyright (c)2014 RiffleHatch
*/
get_header(); ?>
<?php if(!is_paged()): ?>
<?php get_template_part('fronthead'); ?>
<?php if(function_exists('usces_the_item') && term_exists('item')): ?>
<?php
$item = get_category_by_slug('item');
$item_data = get_category($item);
if ( $item_data->count != 0 ):
?>
<div class="row clear">
<!-- 投稿アイテム表示数=12-->
<section class="recommend_items">
<?php $recommend_items = get_posts( array(
'post_type' => 'post',
'category_name' => '$item',
'posts_per_page' => '12',
'orderby' => 'rand',
'suppress_filters' => false,
'meta_query' => array(
array(
'key' => '_isku_',
'value' => '"stock";s:1:"0"',
'compare' => 'LIKE',
),
array(
'key' => '_isku_',
'value' => '"stock";s:1:"1"',
'compare' => 'LIKE',
),
'relation'=>'OR'
)
)); ?>
<h3 itemprop="name"><i class="fa fa-check-square-o"></i> <?php _e('商品一覧'); ?></h3>
<ul class="block itemlist">
<?php foreach( $recommend_items as $post ): setup_postdata( $post ); ?>
<?php get_template_part( 'thumbnail-box' ); ?>
<?php endforeach; wp_reset_postdata(); ?>
</ul>
</section>
</div><!-- row -->
<?php endif; ?>
<?php endif; ?>
<?php endif; ?>
<main id="main" role="main">
<div class="blog-posts hfeed">
<?php if( is_home()): ?>
<?php if(!is_paged()): ?>
<!-- アイテム表示数=12-->
<div class="row clear new_article">
<h3><i class="fa fa-pencil-square"></i> <?php _e('おすすめ商品'); ?></h3>
<div class="col col-8 tablet-col-8 mobile-full site-main">
<?php
$cat_slug = get_category_by_slug('item');
$toppost = get_posts( array(
'post_type' => 'post',
'cat' => -$cat_slug->cat_ID,
'posts_per_page' => '1',
)); ?>
<?php foreach( $toppost as $post ): setup_postdata( $post ); ?>
<?php get_template_part( 'content', get_post_format() ); ?>
<?php endforeach; wp_reset_postdata(); ?>
</div>
<div id="secondary" class="widget-area col col-4 tablet-col-4 mobile-full">
<?php dynamic_sidebar( 'sidebar-1' ); ?>
</div><!-- #secondary -->
</div>
<?php endif; ?>
<?php if ( have_posts() ) : ?>
<div id="moreajax" class="row clear">
<?php while ( have_posts() ) : the_post(); ?>
<div class="site-main col col-6 tablet-col-6 mobile-full">
<?php
get_template_part( 'content', get_post_format() );
?>
</div>
<?php endwhile; ?>
<?php if(!is_paged()): ?><div id="more"></div><?php endif; ?>
<div id="more_disp"><a>もっと表示</a></div>
</div>
<?php endif; ?>
<?php else : ?>
<div class="row clear new_article">
<div class="col col-8 tablet-col-8 mobile-full site-main">
<?php if ( have_posts() ) : ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php get_template_part( 'content', 'page' ); ?>
<?php endwhile; ?>
<?php endif; ?>
</div>
<div id="secondary" class="widget-area col col-4 tablet-col-4 mobile-full">
<?php dynamic_sidebar( 'sidebar-1' ); ?>
</div><!-- #secondary -->
</div>
<?php endif; ?>
</div>
</main><!-- #main -->
<div class="row clear">
<div class=" col col-12 tablet-full mobile-full">
<?php dynamic_sidebar( 'sidebar-7' ); ?>
</div>
</div><!-- row -->
<?php get_footer(); ?>