Guest User

Untitled

a guest
Oct 18th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. $args = array(
  2. 'p' => 1234,
  3. 'post_type' => 'any',
  4. 'post_status' => 'any'
  5. );
  6. $query = new WP_Query( $args );
  7.  
  8. while ( $query->have_posts() ) : $query->the_post();
  9. // display the post
  10. endwhile;
  11.  
  12. wp_reset_postdata();
  13.  
  14. $args = array(
  15. 'labels' => $labels,
  16. 'description' => '',
  17. 'public' => true,
  18. 'publicly_queryable' => true,
  19. 'exclude_from_search' => false,
  20. 'show_ui' => true,
  21. 'menu_position' => 60,
  22. 'menu_icon' => null,
  23. 'capability_type' => post,
  24. 'hierarchical' => false,
  25. 'supports' => array('title', 'editor', 'author', 'excerpt', 'trackbacks', 'custom-fields', 'revisions'),
  26. 'rewrite' => true,
  27. 'query_var' => true,
  28. 'can_export' => true,
  29. 'show_in_nav_menus' => true,
  30. );
  31.  
  32. register_post_type('chart', $args);
  33.  
  34. $args = array(
  35. 'p' => 1234,
  36. 'post_type' => 'any',
  37. 'post_status' => array('draft')
  38. );
  39.  
  40. $args = array(
  41. 'p' => 1234,
  42. 'post_type' => 'any',
  43. 'post_status' => array('publish', 'pending', 'draft', 'auto-draft', 'future', 'private', 'inherit', 'trash')
  44. );
  45.  
  46. $query = new WP_Query();
  47. $posts = $query->query( $args );
  48.  
  49. $args = array(
  50. 'post__in' => array( 123 ),
  51. 'post_type' => 'any',
  52. 'post_status' => 'any',
  53. );
  54. $query = new WP_Query( $args );
  55. // ... etc.
Add Comment
Please, Sign In to add comment