WordPress $post Variable Keys
Below are the methods of retrieving the information that you are most likely to need.
- $post–>ID – ID of the current post.
- $post–>post_category - Retrieves the ID of the post category.
- $post–>post_parent - ID of the page parent. Useful for creating custom navigational elements.
- $post–>post_title – Post Title
- $post–>post_excerpt - Post excerpt
- $post–>post_content – Retrieves all of the post content, along with any markup.
- $post–>post_name – Retrieving the slug of a post.
- $post–>guid – Post Url
- $post–>post_author – ID of post author post_parent
- $post–>post_type - Returns the type, page or post.
- $post–>menu_order - Returns the menu order as set in the post/page editing window. Often menu items are sorted via this value.
- $post–>post_date - Retrieves the integer timestamp for when the post was published. The output can be customized. See the php.net date manual.
- $post–>post_modified - Retrieves the integer timestamp for when the post was last modified.
- $post–>post_status - Retrieves one of five possible posts statuses: publish, private, draft, pending, future.
- $post–>comment_count - Returns the number of comments, pings, and trackbacks for a given post.
And here is how to use it
<?php if (have_posts()) : while (have_posts()) : the_post();
//somewhere in the loop
$yourvariable = $post->post_content;
//do something
endwhile; endif; ?>
Good article
ReplyDeletehttps://wordpress-special-plugin.blogspot.co.id