jegtheme

post-template.php

May 22nd, 2013
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 5.95 KB | None | 0 0
  1. <?php
  2.     /**
  3.      * Single post template
  4.      * @author Jegbagus
  5.      */
  6.     global $post;
  7.     global $jdata; 
  8. ?>
  9. <div id="post-<?php the_ID(); ?>"  <?php post_class(array('blogentry','containerborder')); ?>>
  10.     <div class="inner-container <?php if(has_post_thumbnail()) { echo "headimg" ; } ?>">
  11.         <div class="blog-img">
  12.             <?php if(has_post_thumbnail()) : ?>
  13.                
  14.             <?php if(is_single()){ ?>  
  15.             <a>            
  16.                 <?php $imageHeader = j_get_post_header_image ($post, 'full'); ?>
  17.                 <img src="<?php echo jeg_get_image($imageHeader['src'], $jdata->postImageDim); ?>" alt="<?php echo $imageHeader['alt']?>">
  18.             </a>
  19.             <?php } else { ?>
  20.             <a href="<?php the_permalink(); ?>">               
  21.                 <?php $imageHeader = j_get_post_header_image ($post, 'full'); ?>
  22.                 <img src="<?php echo jeg_get_image($imageHeader['src'], $jdata->postImageDim); ?>" alt="<?php echo $imageHeader['alt']?>">
  23.             </a>   
  24.             <?php } ?>
  25.            
  26.            
  27.             <?php endif; ?>
  28.            
  29.             <div class="blogtitle  <?php if(has_post_thumbnail()) { echo "headingwithimage" ; } ?>">
  30.                 <?php if(!is_single() && !is_page()) : ?>
  31.                 <h2>
  32.                     <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>          
  33.                 </h2>
  34.                 <?php  else : ?>
  35.                 <h1>               
  36.                     <?php the_title(); ?>
  37.                 </h1>
  38.                 <?php endif; ?>
  39.             </div>             
  40.         </div>
  41.        
  42.                
  43.         <?php
  44.         if(isset($jdata->hideMeta) && !$jdata->hideMeta) : ?>
  45.         <div class="portfolio-meta blog-meta">
  46.             <ul>           
  47.                 <li class="addby"><i class="icon-user"></i><?php the_author_posts_link(); ?></li>
  48.                 <li class="addtime"><i class="icon-time"></i><?php echo get_the_date(); ?></li>
  49.                 <?php if(isset($jdata->hideComment) && !$jdata->hideComment) { ?>
  50.                 <li class="commentcount"><i class="icon-comment"></i>
  51.                     <a href="<?php the_permalink();?>#comments">
  52.                         <?php
  53.                             $zerocomment    = j__( 'zerocomment_lang', '0 Comment');
  54.                             $onecomment     = j__( 'onecomment_lang', '1 Comment');
  55.                             $morecomment    = j__( 'morecomment_lang', '% Comments');
  56.                             comments_number($zerocomment, $onecomment, $morecomment);
  57.                         ?>
  58.                     </a>
  59.                 </li>
  60.                 <?php } ?>
  61.                 <div class="clearboth"></div>
  62.             </ul>
  63.         </div>
  64.         <?php endif; ?>
  65.        
  66.         <div class="blog-container">
  67.             <?php          
  68.             if(is_single() || is_page() || $jdata->fullblog){
  69.                 the_content();
  70.                
  71.                 wp_link_pages( array( 'before' => '<div class="page-link">' . 'Pages : ', 'after' => '</div>' ) );
  72.                  
  73.                 if(has_category()) {
  74.                     $catlink = array();
  75.                     foreach(get_the_category() as $category) {
  76.                         $catlink[] = '<a href="' . get_category_link($category->term_id) . '" title="' . $category->description . '">' . $category->name . '</a>';
  77.                     }
  78.                     $catlink = implode(' , ', $catlink);                   
  79.                     printf(j__("filled_under_lang", 'jegtheme'), $catlink);
  80.                 }
  81.                
  82.             } else {
  83.                 $ismore = @strpos( $post->post_content, '<!--more-->');
  84.                
  85.                 if($ismore) {
  86.                     echo substr(the_content(), 0, $ismore);
  87.                 } else {
  88.                     the_excerpt();
  89.                 }
  90.             }?>
  91.         </div>
  92.        
  93.         <div class="bottom-bar">
  94.             <?php if(!is_single() && !is_page()): ?>
  95.             <div class="blog-more" style="float: left; margin-right : 10px;">
  96.                 <ul>
  97.                     <li>
  98.                         <a href="<?php the_permalink();?>" data-rel="tooltip" title="<?php j_e("more_detail");?>">
  99.                             <i class="misc-preview"></i>
  100.                         </a>                       
  101.                     </li>
  102.                 </ul>
  103.             </div>
  104.             <?php endif; ?>    
  105.             <div class="blog-like">
  106.                 <ul>
  107.                     <li>
  108.                         <a  target="_blank" href="<?php echo jShareToFacebook(get_permalink(), get_the_title()); ?>" data-rel="tooltip" title="<?php j_e("share_on_facebook_lang");?>"><i class="social-facebook"></i></a>
  109.                     </li>
  110.                     <li>
  111.                         <a target="_blank" href="<?php echo jShareToTwitter(get_permalink()); ?>" data-rel="tooltip" title="<?php j_e("share_on_twitter_lang");?>"><i class="social-twitter"></i></a>
  112.                     </li>
  113.                     <li>
  114.                         <a target="_blank" href="<?php echo jShareGoogle(get_permalink()); ?>" data-rel="tooltip" title="<?php j_e("share_on_google_lang", "Share on Google Plus");?>"><i class="social-gplust"></i></a>
  115.                     </li>
  116.                 </ul>
  117.                
  118.             </div>
  119.             <?php if(is_single() || $jdata->fullblog): ?>
  120.             <div class="postag">
  121.                 <?php the_tags('',''); ?>
  122.             </div>
  123.             <?php endif; ?>
  124.             <div class="clearbottombar"></div>
  125.         </div>
  126.        
  127.         <?php
  128.             if(is_single()){
  129.                 add_action('previous_post_link', 'j_prev_post');
  130.                 add_action('next_post_link', 'j_next_post');
  131.  
  132.                 function j_prev_post () {
  133.                     $post = get_adjacent_post( null, null , true );
  134.                     if ( ! $post ) {                       
  135.                         $output = "<a href='#' class='nolink'></a>";
  136.                     } else {
  137.                         $title = $post->post_title;
  138.                         $title = apply_filters( 'the_title', $title, $post->ID );                      
  139.                         $rel = $previous ? 'prev' : 'next';
  140.                        
  141.                         $output = '<a href="' . get_permalink( $post ) . '" rel="'.$rel.'">';
  142.                         $output = $output . "<span>" .  j__('prev_pos', 'Previous Post') . "</span>";
  143.                         $output = $output . "<strong>" .  $title . "</strong>";
  144.                         $output = $output . '</a>';
  145.                     }
  146.                     return $output;
  147.                 }
  148.                
  149.                 function j_next_post () {
  150.                     $post = get_adjacent_post( null, null , false );
  151.                     if ( ! $post ) {                       
  152.                         $output = "<a href='#' class='nolink'></a>";
  153.                     } else {
  154.                         $title = $post->post_title;
  155.                         $title = apply_filters( 'the_title', $title, $post->ID );                      
  156.                         $rel = $previous ? 'prev' : 'next';
  157.                        
  158.                         $output = '<a href="' . get_permalink( $post ) . '" rel="'.$rel.'">';
  159.                         $output = $output . "<span>" .  j__('next_pos', 'Next Post') . "</span>";
  160.                         $output = $output . "<strong>" .  $title . "</strong>";
  161.                         $output = $output . '</a>';
  162.                     }
  163.                     return $output;
  164.                 }
  165.         ?>
  166.         <div class="blog-next-prev">
  167.             <div class="blog-next">    
  168.                 <?php echo previous_post_link(); ?>
  169.             </div>
  170.             <div class="blog-prev">
  171.                 <?php echo next_post_link(); ?>
  172.             </div>
  173.         </div>
  174.         <?php
  175.             }
  176.         ?>
  177.        
  178.         <?php      
  179.             // overrided : comments-functions.php
  180.             if(isset($jdata->hideComment) && !$jdata->hideComment) {
  181.                 comments_template();
  182.             }
  183.         ?>
  184.        
  185.     </div>
  186. </div>
Advertisement
Add Comment
Please, Sign In to add comment