How does WordPress obtain the title and content of an article through its ID?

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.