Guest User

Untitled

a guest
Dec 9th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. $postOrdered = array();
  2. $queryPosts = new WP_Query(array(
  3. 'posts_per_page' => -1,
  4. 'post__in' => $postIds,
  5. 'orderby' => 'usp-custom-80', // this tells WP Query to sort by distance
  6. 'order' => 'DESC',
  7. 'orderby' => 'date',
  8. 'meta_key' => 'usp-custom-80',
  9. 'type' => 'DATE',
  10. )
  11. );
  12.  
  13. if( $queryPosts->have_posts() ):
  14. while ( $queryPosts->have_posts() ) : $queryPosts->the_post();
  15. array_push($postOrdered, $post->ID);
  16. $date = usp_get_meta(false, 'usp-custom-80');
  17. echo $date."<br>";
  18. endwhile;
  19. endif;
  20.  
  21. 2-6-2015
  22. 21-12-2018
  23. 26-12-2018
  24. 18-12-2018
  25. 27-12-2018
  26. 12-11-2018
  27. 21-12-2018
  28. 7-12-2018
  29. 5-12-2018
  30. 5-12-2018
  31. 6-12-2018
  32. 19-12-2018
  33. 7-12-2018
  34. 13-12-2018
  35. 24-11-2000
  36. 25-11-2018
  37. 13-11-2018
  38.  
  39. $postOrdered = array();
  40. $date = usp_get_meta(false, 'usp-custom-80');
  41. $date = DateTime::createFromFormat("d.m.Y", $date)->format("m/d/Y");
  42. $queryPosts = new WP_Query(array(
  43. 'posts_per_page' => -1,
  44. 'post__in' => $postIds,
  45. 'orderby' => 'usp-custom-80', // this tells WP Query to sort by distance
  46. 'order' => 'DESC',
  47. 'orderby' => $date,
  48. 'meta_key' => 'usp-custom-80',
  49. 'type' => 'DATE',
  50. )
  51. );
  52.  
  53. if( $queryPosts->have_posts() ):
  54. while ( $queryPosts->have_posts() ) : $queryPosts->the_post();
  55. array_push($postOrdered, $post->ID);
  56. $dateOrdered = usp_get_meta(false, 'usp-custom-80');
  57. echo $dateOrdered."<br>";
  58. endwhile;
  59. endif;
Add Comment
Please, Sign In to add comment