RtThemesSupport

rt17 list_loop.php v2.8

Jun 26th, 2014
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 6.12 KB | None | 0 0
  1. <?php
  2. #
  3. # rt-theme loop
  4. #
  5.  
  6. global $args,$content_width;
  7. add_filter('excerpt_more', 'no_excerpt_more');
  8. $image_width        = ($content_width   =="960") ? 940 : 606;
  9. $image_height       = ($content_width   =="960") ? 500 : 380;
  10.  
  11. if ($args) query_posts($args);
  12.  
  13. if ( have_posts() ) : while ( have_posts() ) : the_post();
  14. ?>
  15.             <?php
  16.             #
  17.            #       featured images
  18.            #
  19.            $rt_gallery_images                      = (get_post_meta( $post->ID, THEMESLUG . "rt_gallery_images", true )) ? get_post_meta( $post->ID, THEMESLUG . "rt_gallery_images", true ) : "";
  20.             $rt_gallery_image_titles        = (get_post_meta( $post->ID, THEMESLUG . "rt_gallery_image_titles", true )) ? get_post_meta( $post->ID, THEMESLUG . "rt_gallery_image_titles", true ) : "";
  21.             $rt_gallery_image_descs                 = (get_post_meta( $post->ID, THEMESLUG . "rt_gallery_image_descs", true )) ? get_post_meta( $post->ID, THEMESLUG . "rt_gallery_image_descs", true ) : "";
  22.             $fist_featured_image            = (is_array($rt_gallery_images)) ? find_image_org_path($rt_gallery_images[0]) : "";
  23.             $resize                                         = (get_post_meta($post->ID, THEMESLUG.'blog_image_resize', true)) ? true : false;
  24.             $is_old_post                            = (get_post_meta($post->ID, THEMESLUG.'is_old_post', true)=="1") ? false : true;
  25.             $crop                                   = (get_post_meta($post->ID, THEMESLUG.'blog_image_crop', true)) ? true : false;
  26.             $width                                  = (get_post_meta($post->ID, THEMESLUG.'blog_image_width', true)) ? get_post_meta($post->ID, THEMESLUG.'blog_image_width', true) : $image_width;
  27.             $meta_height                            = get_post_meta($post->ID, THEMESLUG.'blog_image_height', true);
  28.             $height                                         = (!$meta_height && !$crop) ? 10000 : (($meta_height && !$crop) ? $meta_height : ($meta_height && $crop) ? $meta_height : $image_height);
  29.             $img_position                           = (get_post_meta($post->ID, THEMESLUG.'featured_image_position', true)) ? get_post_meta($post->ID, THEMESLUG.'featured_image_position', true): "center";
  30.             $post_class_img                 = "featured_image_".$img_position;
  31.             $featured_image_usage           = get_post_meta($post->ID, THEMESLUG .'_featured_image_usage', true);  
  32.             $display_gallery_images         = get_post_meta($post->ID, THEMESLUG .'_display_gallery_images', true);        
  33.             $post_format                            = !get_post_format() ? "post" : get_post_format();
  34.             $photo_gallery_images_width     = (get_post_meta( $post->ID, THEMESLUG . "photo_gallery_images_width", true )) ? get_post_meta( $post->ID, THEMESLUG . "photo_gallery_images_width", true ) : 160;
  35.             $photo_gallery_images_height    = (get_post_meta( $post->ID, THEMESLUG . "photo_gallery_images_height", true )) ? get_post_meta( $post->ID, THEMESLUG . "photo_gallery_images_height", true ) : 160;
  36.             $imageURL                               = "";
  37.             $post_uniqueID                          = 'post-'.get_the_ID().'';
  38.      
  39.             if($is_old_post && !$resize) $resize = true; //activate resizer for old posts
  40.            
  41.             //standart post types
  42.             if($post_format == "post"){
  43.                     if($fist_featured_image && $resize) { // if resize is on
  44.                             $image = @vt_resize('', $fist_featured_image, $width, $height, $crop );
  45.                             $imageURL = $image["url"];
  46.                     }else{
  47.                             $imageURL = $fist_featured_image;
  48.                     }        
  49.             }
  50.      
  51.      
  52.             //gallery post types
  53.             if($post_format == "gallery"){
  54.                             $imageURL = $fist_featured_image;
  55.             }
  56.     ?>
  57.     <!-- blog box-->
  58.     <div id="post-<?php the_ID(); ?>" <?php post_class('box one box-shadow '); ?>>
  59.  
  60.         <!-- blog box-->
  61.         <div class="box full blog">
  62.        
  63.             <!-- blog headline-->
  64.             <h5><a href="<?php echo get_permalink() ?>" title="<?php the_title(); ?>">
  65.                 <?php
  66.                     $the_title = search_highlight(trim(get_search_query()), get_the_title());
  67.                     echo $the_title;
  68.                 ?>
  69.             </a></h5>
  70.             <!-- / blog headline-->
  71.                             <?php
  72.      
  73.                             #
  74.                            #       Standart post featured image
  75.                            #
  76.                          
  77.                 if (    $fist_featured_image &&  ($post_format == "post"        || ($display_gallery_images == "only_featured_image"  && $post_format == "gallery"))):?>
  78.                 <!-- blog image-->
  79.                         <a href="<?php echo get_permalink() ?>" title="<?php echo $rt_gallery_image_titles[0]; ?>" class="imgeffect link align<?php echo $img_position;?>">
  80.                             <img src="<?php echo $imageURL;?>" class="featured_image" alt="<?php echo $rt_gallery_image_descs[0]; ?>" /></a>  
  81.                 <!-- / blog image -->
  82.  
  83.                     <?php if($img_position=="center"):?>
  84.                         <div class="space margin-t20"></div>
  85.                     <?php endif;?>
  86.                 <?php endif;?>     
  87.                 <?php if(get_the_excerpt()):?>
  88.                 <!-- blog text-->
  89.                     <?php
  90.                     $the_excerpt = apply_filters('the_content',(get_the_excerpt()));    
  91.                     $the_excerpt = search_highlight(trim(get_search_query()), $the_excerpt);
  92.                     echo $the_excerpt;
  93.                     ?>
  94.                 <!-- /blog text-->
  95.                 <?php endif;?>
  96.             </div>
  97.      
  98.     <div class="clear"></div>  
  99.     </div>
  100.    
  101.     <div class="space margin-b20"></div>
  102.  
  103.     <!-- blog box-->
  104.      
  105.    
  106. <?php endwhile; ?>
  107.  
  108. <div class="clear"></div>
  109.        
  110.     <?php
  111.     //get page and post counts
  112.     $page_count=get_page_count();
  113.    
  114.     //show pagination if page count bigger then 1
  115.     if ($page_count['page_count']>1):
  116.     ?>  
  117.  
  118.     <!-- paging-->
  119.     <div class="paging_wrapper">
  120.        <ul class="paging">
  121.           <?php get_pagination(); ?>
  122.        </ul>
  123.     </div>         
  124.     <!-- / paging-->
  125.    
  126.     <?php endif;?>
  127.  
  128. <?php wp_reset_query();?>
  129.  
  130. <?php else: ?>
  131. <p><?php _e( 'Sorry, no posts matched your criteria.', 'rt_theme'); ?></p>
  132. <?php endif; ?>
Advertisement
Add Comment
Please, Sign In to add comment