lancememan
11/8/2016 - 3:30 AM

Loop Latest Custom Post

Loop Latest Custom Post

<div class="slick-main">
<?php $args = array( 'post_type' => 'product_gallery', 'posts_per_page' => 6,'orderby' => 'date','order' => 'DESC' );
     $loop = new WP_Query( $args );
     while ( $loop->have_posts() ) : $loop->the_post(); 
     $image1 = get_field('image1');
     $url1 = $image1['url'];
?>
   <div><a href="<?php the_permalink(); ?>"><img src="<?php echo $url1; ?>"></a></div>
<?php endwhile; ?>
</div>
<script>
var j = jQuery.noConflict();
j('.slick-main').slick({
  dots: false,
  infinite: true,
  speed: 300,
  slidesToShow: 1,
  adaptiveHeight: true
});
</script>
function new_arrivals_func( $atts ){
    ob_start(); // begin output buffering
    include('new-arrival-loop.php');
    $output = ob_get_contents(); // end output buffering
    ob_end_clean(); // grab the buffer contents and empty the buffer
    return $output;
}

add_shortcode( 'new-arrivals', 'new_arrivals_func' );