Advertisement
Guest User

Slider

a guest
Dec 15th, 2012
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.37 KB | None | 0 0
  1.     <!-- Slider -->
  2.     <div class="main_slider">
  3.         <div class="container_12">
  4.             <div class="grid_12">
  5.                 <ul class="slider_container" id="themedrops_slider">
  6.                     <?php
  7.                         $cat_collect = array();
  8.                         $args = array(
  9.                         'type'                     => 'post',
  10.                         'child_of'                 => 0,
  11.                         'orderby'                  => 'name',
  12.                         'order'                    => 'ASC',
  13.                         'hide_empty'               => 0,
  14.                         'hierarchical'             => 1,               
  15.                         'taxonomy'                 => 'category',
  16.                         'pad_counts'               => false );                         
  17.                         $categories = get_categories( $args );                       
  18.                         $cat_exclude = array();
  19.                         foreach ($categories as $category) {
  20.                             if(get_option('_slide'.$category->cat_ID))
  21.                             {
  22.                                 $cat_exclude[] = $category->cat_ID;
  23.                             }
  24.                         }
  25.                        
  26.                         $arg = array('posts_per_page' => 5,'category__not_in'=>$cat_exclude);
  27.                         $query = new wp_query($arg);
  28.                         while($query->have_posts())
  29.                         {
  30.                             $query->the_post();
  31.                            
  32.                             $args = array(
  33.                             'post_type' => 'attachment',
  34.                             'numberposts' => 4,
  35.                             'post_status' => null,
  36.                             'post_parent' => get_the_ID()
  37.                             );
  38.                            
  39.                             $attachments = get_posts( $args );
  40.                            
  41.                             if ( $attachments ) {
  42.                                 $counter = 0;
  43.                                 $min=0;
  44.                                 foreach ( $attachments as $attachment ) {
  45.                                     $img_full = wp_get_attachment_image_src( $attachment->ID,'image-11');
  46.                                     if($img_full[1] == 596 || $img_full[1] > 596)
  47.                                     {
  48.                                         break;
  49.                                     }else if($min < $img_full[1])
  50.                                     {
  51.                                         $min = $img_full[1];
  52.                                     }
  53.                                     else{break;}
  54.                                 }
  55.                                 $img = $img_full[0];
  56.                             }else if(catch_that_image())
  57.                             {
  58.                                 $img = catch_that_image();
  59.                             }                          
  60.                             if($img)
  61.                             {?>
  62.                                 <!-- Slider Items -->
  63.                                 <li>                       
  64.                                     <div class="featured_image">
  65.                                         <a href="<?php  echo $img; ?>" class="overlay view_image">
  66.                                             <img src="<?php echo $img; ?>" width="605" height="365" alt="blog-post-img" />
  67.                                         </a>
  68.                                     </div>
  69.    
  70.                                     <div class="featured_text">
  71.                                         <h1>
  72.                                             <a href="<?php the_permalink(); ?>">
  73.                                             <?php
  74.                                             // short_title($after, $length)
  75.                                             echo short_title('...', 10);
  76.                                             ?>
  77.                                             </a>
  78.                                         </h1>
  79.                                         <div class="post_details">
  80.                                             <div class="author_date">
  81.                                                 Por
  82.                                                 <a href="<?php echo get_author_posts_url(get_the_author_meta( 'ID' )); ?>">
  83.                                                 <?php echo get_the_author(); ?></a>
  84.                                                 em
  85.                                                 <?php $day = get_the_date('d'); $month = get_the_date('m'); $year = get_the_date('Y'); ?>
  86.                                                 <a href="<?php echo get_day_link($year,$month,$day); ?>">
  87.                                                 <?php echo $day ?></a> /
  88.                                                 <a href="<?php echo get_month_link($year,$month); ?>">
  89.                                                 <?php echo $month ?>
  90.                                                 </a> /
  91.                                                 <a href="<?php echo get_year_link($year);?>">
  92.                                                 <?php echo $year ?>
  93.                                                 </a>
  94.                                             </div>
  95.                                             <a class="comment_box" href="<?php the_permalink(); ?>"><?php echo get_comments_number(); ?></a>
  96.                                         </div>
  97.    
  98.                                         <div class="post_text">
  99.                                             <?php
  100.                                             if ( ! function_exists( 'taduo_exceprt_length' ) ) :
  101.    
  102.                                                 function taduo_exceprt_length( $length ) {
  103.                                                     return 70;
  104.                                                 }
  105.                                             endif;
  106.                                             add_filter( 'excerpt_length', 'taduo_exceprt_length' );
  107.                                             if ( ! function_exists( 'taduo_exerpt' ) ) :
  108.                                                 function taduo_exerpt($more) {                                         
  109.                                                     return '...';
  110.                                                 }
  111.                                             endif;
  112.                                             add_filter('excerpt_more', 'taduo_exerpt');
  113.                                             the_excerpt();
  114.                                             remove_filter( 'excerpt_length', 'taduo_exceprt_length' );
  115.                                             remove_filter('excerpt_more', 'taduo_exerpt');
  116.                                             ?>
  117.                                         </div>
  118.                                         <a href="<?php the_permalink(); ?>" class="btn">
  119.                                             <span>Leia Mais</span>
  120.                                         </a>                   
  121.                                     </div>
  122.                                 </li>
  123.                                 <!-- End of: Slider Item -->
  124.                                 <?php
  125.                             }//Close IF
  126.                         }//Close While
  127.                     ?>
  128.                    
  129.                 </ul>
  130.                 <div class="clear"></div>
  131.                 <div class="slider_shadow"></div>
  132.                 <!-- Slider Buttons -->
  133.                 <div class="slider_buttons">
  134.                 </div>
  135.                 <!-- End of: Slider Buttons -->
  136.             </div>
  137.         </div>
  138.     </div>
  139.     <!-- End of: Slider -->
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement