Advertisement
hmbashar

Slider Dynamic

Feb 28th, 2015
488
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.11 KB | None | 0 0
  1.                     <?php
  2.                     global $post;
  3.                     $slider_post_count = 5;
  4.                     $main_slider_cat_id = 3;
  5.                     $args = array( 'posts_per_page' => $slider_post_count, 'post_type'=> 'post', 'orderby' => 'menu_order', 'order' => 'ASC', 'category' => 'main_slider_cat_id' );
  6.                     $myposts = get_posts( $args );
  7.                     foreach( $myposts as $post ) : setup_postdata($post); ?>
  8.                      
  9.                     <?php
  10.                        $slider_effect_class= get_post_meta($post->ID, 'slider_effect_class', true);
  11.                        $data_slotamount= get_post_meta($post->ID, 'data_slotamount', true);
  12.                        $data_masterspeed= get_post_meta($post->ID, 'data_masterspeed', true);
  13.                        $main_slider_img = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'main_slider_img' );
  14.                        
  15.                        
  16.                     ?>
  17.  
  18.                         <li data-transition="<?php echo $slider_effect_class; ?>" data-slotamount="<?php echo $data_slotamount;?>" data-masterspeed="<?php echo $data_masterspeed; ?>">
  19.                             <!-- THE MAIN IMAGE IN THE FIRST SLIDE -->
  20.                             <img alt="" src="<?php echo $main_slider_img[0]; ?>" />
  21.                             <?php the_content();?>
  22.                         </li>
  23.  
  24.                        
  25.                        
  26.                     <?php endforeach; ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement