Link: http://www.isyeo.com/wordpress/wordpress-getpost.html #
On a non-single. PHP page, we sometimes want to call the currentArticleThe title, content, and other information. When WordPress generates an article page, only the current article Id remains unchanged on each page, how can I obtain the title and content of the current article through this ID? You can use the followingCodeImplementation:
<? PHP $ id = // article Id $ Title = get_post ($ id)-> post_title; echo $ title; // output article title?>
Other information can be achieved by changing plst_title:
post_author :( integer) Number of the author of the article
post_data :( character) the date and time of the article (YYYY-MM-DD HH-MM-SS)
post_data_gmt :( character) Greenwich Mean Time (GMT) published in the article (YYYY-MM-DD HH-MM-SS)
post_content :( character) content
post_title :( character) article Title
post_category: (integer) Document category number. Note: The total number of versions after WordPress 2.1 is 0. You can use the get_the_category () function to define the document category.
post_excerpt: (character) Abstr
post_status :( character) Document Status (publish | pending | draft | private | static | object | attachment | inherit | future)
comment_status: (character) Comment status (Open | closed | registered_only)
ping_status :( character) pingback/trackback status (Open | closed)
post_password :( character) password
post_name: (character) URL nesting of the article
to_ping: (character) URL link to be referenced
pinged :( character) referenced link
post_modified :( character) article last modified (YYYY-MM-DD HH-MM-SS)
post_modified_gmt :( Character) post last modified GMT time (YYYY-MM-DD HH-MM-SS)
post_parent :( integer) parent article number (for attachments, etc.)
guid :( character) a link to the article. Note: The GUID cannot be used as a permanent link (although it is indeed used as a permanent link in versions earlier than 2.5) or as a usable link to the article. GUID is a unique identifier, but it happens to be a link to the article.
post_type: (character) (log | PAGE | attachment)
post_mime_type: (character) MIME type (for attachments, etc.)
comment_count :( integer) total comments