File: /virtual/nagasaki/public_html/shop/wp-content/themes/riffles_ver1.1/fronthead.php
<?php
/**
* @package Riffles
* @link http://www.u-hg.com/
* @author RiffleHatch
* @copyright Copyright (c)2014 RiffleHatch
*/
?>
<?php if(get_header_image()): ?>
<section class="top-slider">
<?php $headers = get_uploaded_header_images(); ?>
<?php if($headers): ?>
<div class="flexslider">
<ul class="slides">
<?php $count = ''; ?>
<?php foreach ($headers as $key => $value): ?>
<?php $img_id = $value['attachment_id'];
$img_meta = get_post($img_id); ?>
<li style="background:url(<?php echo $value['url']; ?>) no-repeat 50% 50%;">
<?php if($img_meta->post_content && (strpos($img_meta->post_content, 'jpg')===false)): ?>
<a href="<?php echo esc_html($img_meta->post_content); ?>">
<?php endif; ?>
<?php if($img_meta->post_title && (strpos($img_meta->post_title, 'jpg')===false)): ?>
<p class="top-slider-p slp<?php echo $count; ?> top-slider-title slidp<?php echo $count; ?>"><?php echo esc_html($img_meta->post_title); ?></p>
<?php endif; ?>
<?php if($img_meta->post_excerpt): ?>
<p class="top-slider-p slp<?php echo $count; ?> top-slider-caption slidpb<?php echo $count; ?>"><?php echo esc_html($img_meta->post_excerpt); ?></p>
<?php endif; ?>
<?php if($img_meta->post_content && (strpos($img_meta->post_content, 'jpg')===false)): ?>
</a>
<?php endif; ?>
</li>
<?php $count++; ?>
<?php endforeach; ?>
</ul>
</div>
<?php endif; ?>
</section>
<!-- section -->
<?php else: ?>
<?php if(function_exists('usces_the_item') && term_exists('item')): ?>
<section class="top-slider">
<div class="flexslider">
<ul class="slides">
<?php
$item = get_category_by_slug('item');
$item_data = get_category($item);
if ( $item_data->count != 0 ):
?>
<?php $new_slides = get_posts( array(
'post_type' => 'post',
'category_name' => '$item',
'posts_per_page' => '12',
'orderby' => 'modified',
'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'
)
)); ?>
<?php $count = ''; ?>
<?php foreach( $new_slides as $post ): setup_postdata( $post ); ?>
<?php if($count >= 5){ break; } ?>
<?php if( has_post_thumbnail()) : ?>
<?php
$image_id = get_post_thumbnail_id();
$image_url = wp_get_attachment_image_src($image_id, true);
$image_caption = get_post(get_post_thumbnail_id())->post_excerpt;
$image_description = get_post(get_post_thumbnail_id())->post_content;
?>
<li style="background:url(<?php echo $image_url[0]; ?>) no-repeat 50% 50%;">
<a href="<?php the_permalink(); ?>">
<p class="top-slider-p slp<?php echo $count; ?> top-slider-title slidp<?php echo $count; ?>"><?php echo $image_caption; ?></p>
<p class="top-slider-p slp<?php echo $count; ?> top-slider-caption slidpb<?php echo $count; ?>"><?php echo $image_description; ?></p>
</a>
</li>
<?php $count++; ?>
<?php endif; ?>
<?php endforeach; wp_reset_postdata(); ?>
<?php endif; ?>
</ul>
</div>
</section>
<!-- section -->
<?php endif; ?>
<?php endif; ?>