Advertisement
Guest User

Untitled

a guest
May 1st, 2016
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 8.97 KB | None | 0 0
  1. <?php get_header(); ?>
  2. <?php
  3.     $lang = pll_current_language('slug');
  4.     $all_names = array('ko' => '전체', 'en' => 'Total' , 'zh' => '總數', 'ja' => '総合');
  5.     $recent_path = array('ko' => '최신 PATH', 'en' => 'Recent PATH Stories' , 'zh' => '最新樂途故事', 'ja' => '最新のPATHストーリー');
  6.     $recommend_path = array('ko' => '추천 PATH', 'en' => 'Recommended PATH Stories' , 'zh' => '樂途故事推薦', 'ja' => 'おすすめのPATHストーリー');
  7.     $story_path = array('ko' => 'PATH 목록', 'en' => 'PATH Stories Directory' , 'zh' => '樂途故事指南', 'ja' => 'PATHストーリー一覧');
  8. ?>
  9.         <?php
  10.             //get user like string from cookie for use in later check
  11.             $like_string = mb_cookie_get_key_value ("inspire_cookie", "likes");
  12.             $likes = get_post_meta(get_the_ID(), 'inspire_likes', true);
  13.             if (empty($likes)) $likes = 0;
  14.  
  15.             $inspire_options_post = get_option('inspire_options_post');
  16.  
  17.             $layout = $inspire_options_post['post_style'];      //single, full, full_sidebar
  18.  
  19.             switch ($layout) {
  20.                 case "single":
  21.                     $featured_img_width = 650;
  22.                     break;
  23.                 case "full":
  24.                     $featured_img_width = 990;
  25.                     break;
  26.                 case "full_sidebar":
  27.                     $featured_img_width = 990;
  28.                     break;
  29.                 default:
  30.                     $featured_img_width = 650;
  31.                     break;
  32.             }
  33.             $post_thumbnail_src = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()),'full');
  34.             if ($post_thumbnail_src[1] < $featured_img_width) $featured_img_width = $post_thumbnail_src[1];
  35.  
  36.             //get attachments
  37.              $args = array(
  38.                'post_type' => 'attachment',
  39.                'numberposts' => -1,
  40.                'post_status' => null,
  41.                'post_parent' => $post->ID
  42.               );
  43.  
  44.               $project_attachments = get_posts( $args );
  45.               //var_dump($project_attachments);
  46.  
  47.         ?>
  48.  
  49.         <!-- FEATURED IMAGE FOR FULL_SIDEBAR-->
  50.         <?php
  51.             if (has_post_thumbnail(get_the_ID()) && $layout == "full_sidebar" && isset($inspire_options_post['show_featured'])) {
  52.             ?>
  53.                 <div class='post-img full'>
  54.                     <div class='flexslider flexslider_single'>
  55.                         <ul class="slides">
  56.                             <?php printf("<li><a href='%s'><img width='%d' src='%s'></a></li>", esc_url($post_thumbnail_src[0]), esc_attr($featured_img_width), esc_url($post_thumbnail_src[0])); ?>
  57.  
  58.                             <?php
  59.                                 for ($i = 0; $i < count($project_attachments); $i++) {
  60.                                     if (get_post_thumbnail_id(get_the_ID()) != $project_attachments[$i]->ID) {
  61.                                         $attachment_src = wp_get_attachment_image_src($project_attachments[$i]->ID, 'full');
  62.                                         printf("<li><a href='%s'><img width='%d' src='%s'></a></li>", esc_url($attachment_src[0]), esc_attr($featured_img_width), esc_url($attachment_src[0]));
  63.                                     }
  64.                                 }
  65.  
  66.                             ?>
  67.                         </ul>
  68.                     </div>
  69.                 </div>
  70.             <?php
  71.             }
  72.         ?>
  73.  
  74.         <div id="content" class="<?php echo $layout; ?>">
  75.  
  76.  
  77.             <!-- BEGIN LOOP -->
  78.             <?php while ( have_posts() ) : the_post(); ?>
  79.  
  80.                 <div id="post-<?php the_ID(); ?>" <?php post_class($layout); ?> data-post_ID="<?php the_ID(); ?>" data-nonce="<?php echo wp_create_nonce('like_post'); ?>">
  81.  
  82.  
  83.                     <!-- FEATURED IMAGE FOR SINGLE & FULL-->
  84.  
  85.  
  86.                     <!-- TITLE AND META -->
  87.                     <div class="post-title">
  88.  
  89.                         <!-- <strong><?php echo get_post_meta(get_the_ID(), 'cmb_slider_cap_text', true); ?></strong> -->
  90.                         <h1><?php the_title(); ?></h1>
  91.  
  92.  
  93.                     </div>
  94.  
  95.                     <!-- MAIN CONTENT AND TAGS -->
  96.                     <div class="post-entry">
  97.  
  98.                         <?php the_content(); ?>
  99.  
  100.                         <?php wp_link_pages(); ?>
  101.  
  102.                         <div class="clearfix"></div>
  103.  
  104.                         <!-- <div class="tags">
  105.                             <?php the_tags("",""); ?>
  106.                         </div> -->
  107.  
  108.                     </div>
  109.  
  110.                     <!-- POST PAGINATION -->
  111.                     <div class="with_path">
  112.                     <h4><?php echo $recent_path[$lang] ?></h4>
  113.                     <ul>
  114.                     <?php
  115.                         $categories = get_the_category();
  116.                         // print_r($categories);
  117.                         // foreach ($categories as $category){
  118.                             // echo "==========================".$category->category_parent;
  119.                         // }                                               
  120.                         $parent_id = trim(esc_html(end($categories)->category_parent));
  121.                         $parent_url = get_category_link($parent_id);
  122.                         $parent_name = get_category($parent_id)->cat_name;
  123.                        
  124.                         //bitly 정보 확인
  125.                         $short_url = get_bilty_url($post->ID);
  126.                         $link_title = get_the_title();
  127.                     ?> 
  128.                     <?php
  129.                         // wp_reset_query();
  130.                         // $cat_id = the_category_ID($echo);
  131.                         // $cur_cat = new WP_Query();
  132.                         // $cur_cat->Query('posts_per_page=5&cat='.$cat_id);
  133.                         $category = get_the_category();
  134.                         $parent_id = trim(esc_html(end($category)->category_parent));
  135.                         $parent_url = get_category_link($parent_id);
  136.  
  137.                         $date = get_the_date('Y-m-d H:i:s');
  138.                         $args = array(
  139.                             'cat' => $parent_id,
  140.                             'date_query' => array(
  141.                                 'before' => $date,
  142.                                 'inclusive' => true                            
  143.                             ),                                                     
  144.                             'posts_per_page' => 5,
  145.                         );
  146.                         $cur_cat = new WP_Query( $args );
  147.                         while($cur_cat->have_posts()) : $cur_cat->the_post();
  148.                     ?>
  149.                     <li><a href="<?php echo the_permalink();?>"><?php echo the_title();?></a></li>
  150.                     <?php
  151.                         endwhile;
  152.                     ?>
  153.                    
  154.                     <script type="text/javascript">
  155.                         jQuery(document).ready(function(){
  156.                             // 사용할 앱의 JavaScript 키를 설정해 주세요.
  157.                             Kakao.init('ee656f365475d7c191508379e7f03f5c');
  158.  
  159.                             // 카카오톡 링크 버튼을 생성합니다. 처음 한번만 호출하면 됩니다.
  160.                             Kakao.Link.createTalkLinkButton({
  161.                               container: '.sns_kt',
  162.                               label: '카카오링크 샘플에 오신 것을 환영합니다.',
  163.                               image: {
  164.                                 src: 'http://dn.api1.kage.kakao.co.kr/14/dn/btqaWmFftyx/tBbQPH764Maw2R6IBhXd6K/o.jpg',
  165.                                 width: '300',
  166.                                 height: '200'
  167.                               },
  168.                               webButton: {
  169.                                 text: '카카오 디벨로퍼스',
  170.                                 url: 'https://dev.kakao.com/docs/js' // 앱 설정의 웹 플랫폼에 등록한 도메인의 URL이어야 합니다.
  171.                               }
  172.                             });
  173.                         });
  174.                     </script>
  175.                     </ul>
  176.                     </div>
  177.                     <div class="btns">
  178.                         <div class="sns_box clearfix">
  179.                             <ul>
  180.                                 <li><a href="https://twitter.com/intent/tweet?text=<?=$link_title?>&amp;url=<?=urlencode($short_url)?>" class="sns_tw" target="_blank" title="Twitter">Twitter</a></li>
  181.                                 <li><a href="http://www.facebook.com/sharer.php?u=<?=urlencode($short_url)?>" class="sns_fb" target="_blank" title="Facebook">Facebook</a></li>
  182.                                 <li><a href="https://story.kakao.com/share?url=<?=urlencode($short_url)?>" class="sns_ks" target="_blank" title="Kakaostory">Kakaostory</a></li>
  183.                                 <li><a href="javascript:;" class="sns_kt" target="_blank" title="Kakaotalk">Kakaotalk</a></li>
  184.                                 <li><a href="http://line.naver.jp/R/msg/text/?<?=urlencode($short_url)?>=<?=urlencode($short_url)?>" class="sns_ln" target="_blank" title="Line">Line</a></li>
  185.                                 <li><a href="whatsapp://send?text=<?=urlencode($short_url)?>" data-action="share/whatsapp/share" class="sns_wa">Whatsapp</a></li>
  186.                             </ul>
  187.                         </div>
  188.                         <a href="<?php echo $parent_url; ?>"><?php echo $parent_name; ?></a>
  189.                     </div>
  190.                     <div class="recommend_list">
  191.                         <h2><?php echo $recommend_path[$lang] ?></h2>
  192.                         <ul class="clearfix">
  193.                         <?php
  194.                             wp_reset_query();
  195.                             $cat_id = get_category_by_slug('recommend')->cat_ID;
  196.                             $cur_cat = new WP_Query();
  197.                             $cur_cat->Query('posts_per_page=3&cat='.$cat_id);
  198.                             while($cur_cat->have_posts()) {
  199.                                 $cur_cat->the_post();
  200.                                 $post_thumbnail_src = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()),"full");
  201.                                 $category = get_the_category();
  202.                                 $title = get_the_title();
  203.                                 $excerpt = get_the_content();
  204.                                 $link = get_permalink();
  205.                                 $vol = get_post_meta(get_the_ID(), 'cmb_slider_cap_text', true);
  206.                         ?>
  207.                             <li>
  208.                                 <a href="<?php echo $link; ?>">
  209.                                     <span class="thumb"><img src="<?php echo $post_thumbnail_src[0]; ?>" alt="" /></span>
  210.                                     <div class="inner">
  211.                                         <span class="vol"><?php echo $vol; ?></span>
  212.                                         <strong class="title"><?php echo $title; ?></strong>
  213.                                         <span class="desc"><?php echo trim(mb_make_excerpt($excerpt, 200, true)); ?></span>
  214.                                     </div>
  215.                                 </a>
  216.                             </li>
  217.                         <?php
  218.                             }
  219.                         ?>
  220.                         </ul>
  221.                     </div>
  222.  
  223.  
  224.                     <!-- SHARE THE LOVE -->
  225.                     <?php if (isset($inspire_options_post ['show_share'])) get_template_part('inc/templates/template_post_share'); ?>
  226.  
  227.                     <!-- COMMENTS -->
  228.                     <?php if (isset($inspire_options_post ['show_comments'])) comments_template( '', true ); ?>
  229.  
  230.  
  231.                 </div>
  232.                 <!-- class: post -->
  233.  
  234.             <?php endwhile; ?>
  235.             <!-- END LOOP -->
  236.  
  237.  
  238.  
  239.         </div> <!-- id:content -->
  240.  
  241. <?php if ($layout == "single" || $layout == "full_sidebar") get_sidebar(); ?>
  242.  
  243. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement