2019-02-06 12:08:25 PHP

PHP

Copy Copied! Full
<?php /** * The main template file * * This is the most generic template file in a WordPress theme * and one of the two required files for a theme (the other being style.css). * It is used to display a page when nothing more specific matches a query. * E.g., it puts together the home page when no home.php file exists. * * @link https://developer.wordpress.org/themes/basics/template-hierarchy/ * * @package horeru */ get_header(); ?> <div class="fv-slider"> <div class="swiper-container main-slider loading"> <div class="swiper-wrapper"> <?php $args = array( 'posts_per_page' => 5, 'post_status' => 'publish', 'key'=>'fv-slider', 'compare'=>'=', 'value'=>'1' ); foreach (get_posts($args) as $post): setup_postdata($post); ?> <div class="swiper-slide main-slide"> <figure class="slide-bgimg"> <?php the_post_thumbnail('large');?> </figure> <div class="content container main-slide__content"> <div class="row justify-content-center"> <div class="col-12 col-md-10 col-lg-8"> <h1 class="title main-slide__content__ttl"> <a href="<?php echo get_permalink();?>"> <?php the_title(); ?> </a> </h1> <a href="<?php echo get_permalink();?>" class="caption main-slide__content__cap"> <?php if (!wp_is_mobile()) { if (mb_strlen($post->post_content, 'UTF-8')>120) { $content= str_replace('\n', '', mb_substr(strip_tags($post-> post_content), 0, 120, 'UTF-8')); echo $content.'…'; } else { echo str_replace('\n', '', strip_tags($post->post_content)); } } else { if (mb_strlen($post->post_content, 'UTF-8')>40) { $content= str_replace('\n', '', mb_substr(strip_tags($post-> post_content), 0, 40, 'UTF-8')); echo $content.'…'; } else { echo str_replace('\n', '', strip_tags($post->post_content)); } } ?> </a> <div class="post-list-02__contents__cat-date"> <?php $cat = get_the_category(); $cat_id = $cat[0]->cat_ID; $cat_name = $cat[0]->name; $cat_slug = $cat[0]->category_nicename; $cat_link = get_category_link($cat_id); ?> <a class="link-color link-color--<?php echo $cat_slug ?>" href="<?php echo $cat_link; ?>"> <?php echo $cat_name; ?> </a> <span><?php echo '/ ' . get_the_date('Y.m.d'); ?></span> </div> </div> </div> </div> </div> <?php endforeach; wp_reset_postdata(); ?> </div> <!-- If we need navigation buttons --> <div class="swiper-button-prev swiper-button-white"></div> <div class="swiper-button-next swiper-button-white"></div> </div> <!-- Thumbnail navigation --> <div class="swiper-container nav-slider loading"> <div class="swiper-wrapper"> <?php $args = array( 'posts_per_page' => 5, 'post_status' => 'publish', 'key'=>'fv-slider', 'compare'=>'=', 'value'=>'1' ); foreach (get_posts($args) as $post): setup_postdata($post); ?> <div class="swiper-slide"> <figure class="slide-bgimg"> <?php the_post_thumbnail('medium');?> </figure> <div class="content"> <!--<h1 class="title"> <?php /* if ($pickup) { echo $post->post_title; } elseif (mb_strlen($post->post_title, 'UTF-8')>34) { $title= mb_substr($post->post_title, 0, 34, 'UTF-8'); echo $title.'…'; } else { echo $post->post_title; } */ ?> </h1>--> </div> </div> <?php endforeach; wp_reset_postdata(); ?> </div> </div> </div> <section class="section-bg--dark container-fluid"> <div class="container"> <h1 class="section-title--light">Category's Pick up</h1> <div class="scroll-flex"> <?php $posts = get_pickup_posts(); foreach ($posts as $post): setup_postdata($post); ?> <div class="scroll-flex__content col-12 col-md-6 col-lg-4"> <?php include('template-parts/post-list-cat.php'); ?> </div> <?php endforeach; wp_reset_postdata(); ?> </div> </div> </section> <section class="section-bg--light container-fluid"> <div class="container"> <h1 class="section-title--dark">New Articles</h1> <div class="row"> <?php $args = array( 'posts_per_page' => 9, 'post_status' => 'publish' ); ?> <?php foreach (get_posts($args) as $post) { setup_postdata($post); include('template-parts/post-list.php'); } wp_reset_postdata(); ?> </div> <a href="<?php echo esc_url(home_url()); ?>/article-top" class="newart-more"> <p>read more</p> </a> </div> </section> <section class="section-bg--dark container-fluid"> <div class="container"> <h1 class="section-title--dark">Search Clubs</h1> <div class="row"> <div class="col-12 col-lg-6"> <?php include('template-parts/search-form.php'); ?> </div> <div class="d-none d-lg-block col-lg-6"> <?php $args = array( 'posts_per_page' => 1, 'post_status' => 'publish', 'post_type' => 'shops', 'orderby' => 'rand' ); ?> <?php foreach (get_posts($args) as $shop): setup_postdata($shop); include('template-parts/shop-image.php'); ?> <?php endforeach; ?> </div> </div> </div> </section> <section class="section-bg--light container-fluid"> <div class="container"> <h1 class="section-title--dark">New Arrival</h1> <div class="row"> <?php $args = array( 'posts_per_page' => 6, 'post_status' => 'publish', 'post_type' => 'shops' ); ?> <?php foreach (get_posts($args) as $shop): setup_postdata($shop); ?> <div class="col-12 col-lg-6"> <?php include('template-parts/shop-list.php'); ?> </div> <?php endforeach; ?> </div> </div> </section> <script src="https://cdnjs.cloudflare.com/ajax/libs/Swiper/4.4.6/js/swiper.min.js"></script> <script src="<?php echo get_template_directory_uri(); ?>/js/animation/animation.js"></script> <?php get_footer();
RECOMMEND