miriamdepaula

WordPress: Usando get_post()

Sep 14th, 2012
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.62 KB | None | 0 0
  1. <?php
  2. /****************************
  3. referencia de uso: http://codex.wordpress.org/Function_Reference/get_post
  4.  
  5. ID
  6. (integer) The post ID
  7.  
  8. post_author
  9. (integer) The post author's ID
  10.  
  11. post_date
  12. (string) The datetime of the post (YYYY-MM-DD HH:MM:SS)
  13.  
  14. post_date_gmt
  15. (string) The GMT datetime of the post (YYYY-MM-DD HH:MM:SS)
  16.  
  17. post_content
  18. (string) The post's contents
  19.  
  20. post_title
  21. (string) The post's title
  22.  
  23. post_category
  24. (integer) The post category's ID. Note that this will always be 0 (zero) from wordpress 2.1 onwards. To determine a post's category or categories, use get_the_category().
  25.  
  26. post_excerpt
  27. (string) The post excerpt
  28.  
  29. post_status
  30. (string) The post status (publish|pending|draft|private|static|object|attachment|inherit|future|trash)
  31.  
  32. comment_status
  33. (string) The comment status (open|closed|registered_only)
  34.  
  35. ping_status
  36. (string) The pingback/trackback status (open|closed)
  37.  
  38. post_password
  39. (string) The post password
  40.  
  41. post_name
  42. (string) The post's URL slug
  43.  
  44. to_ping
  45. (string) URLs to be pinged
  46.  
  47. pinged
  48. (string) URLs already pinged
  49.  
  50. post_modified
  51. (string) The last modified datetime of the post (YYYY-MM-DD HH:MM:SS)
  52.  
  53. post_modified_gmt
  54. (string) The last modified GMT datetime of the post (YYYY-MM-DD HH:MM:SS)
  55.  
  56. post_content_filtered
  57. (string)
  58.  
  59. post_parent
  60. (integer) The parent post's ID (for attachments, etc)
  61.  
  62. guid
  63. (string) A link to the post. Note: One cannot rely upon the GUID to be the permalink (as it previously was in pre-2.5), Nor can you expect it to be a valid link to the post. It's merely a unique identifier, which so happens to be a link to the post at present.
  64.  
  65. menu_order
  66. (integer)
  67.  
  68. post_type
  69. (string) (post|page|attachment)
  70.  
  71. post_mime_type
  72. (string) Mime Type (for attachments, etc)
  73.  
  74. comment_count
  75. (integer) Number of comments
  76. ***************************/
  77. ?>
  78.  
  79. <div id='post1'>
  80. <?php
  81. $post1 = 2;
  82. $post = get_post($post1);
  83. ?>
  84.  
  85. <h2> <?php echo $post->post_title?> </h2>
  86. <?php echo $post->post_content ?>
  87. </div>
  88.  
  89. <div id='post2'>
  90. <?php
  91. $post2 = 56;
  92. $post = get_post($post2);
  93. ?>
  94.  
  95. <h2> <?php echo $post->post_title?> </h2>
  96. <?php echo $post->post_content ?>
  97. </div>
  98.  
  99. <div id='post3'>
  100. <?php
  101. $post3 = 66;
  102. $post = get_post($post3);
  103. ?>
  104.  
  105. <h2> <?php echo $post->post_title?> </h2>
  106. <?php echo $post->post_content ?>
  107. </div>
  108.  
  109. <div id='post4'>
  110. <?php
  111. $post4 = 104;
  112. $post = get_post($post4);
  113. ?>
  114.  
  115. <h2> <?php echo $post->post_title?> </h2>
  116. <?php echo $post->post_content ?>
  117. </div>
  118.  
  119. <div id='post5'>
  120. <?php
  121. $post5 = 130;
  122. $post = get_post($post5);
  123. ?>
  124.  
  125. <h2> <?php echo $post->post_title?> </h2>
  126. <?php echo $post->post_content ?>
  127. </div>
Advertisement
Add Comment
Please, Sign In to add comment