Advertisement
aitormendez

lolafonseca front page

Aug 2nd, 2016
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.67 KB | None | 0 0
  1. <?php
  2. // WP_Query arguments
  3. $args = array (
  4.     'post_type'         => array( 'product', 'post' ),
  5.     'nopaging'          => true,
  6.   'meta_key'          => '_featured',
  7.   'meta_value'        => 'yes',
  8.   'orderby' => 'date',
  9.   'order' => 'desc',
  10. );
  11.  
  12. // The Query
  13. $front_query = new WP_Query( $args );
  14.  
  15. print_r( $front_query->request );
  16.  
  17. // The Loop
  18. if ( $front_query->have_posts() ) {
  19.     while ( $front_query->have_posts() ) {
  20.         $front_query->the_post();
  21.     get_template_part('templates/content', get_post_type() != 'post' ? get_post_type() : get_post_format());
  22.     }
  23. } else {
  24.     // no posts found
  25.   echo 'no';
  26. }
  27.  
  28. // Restore original Post Data
  29. wp_reset_postdata();
  30. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement