WordPress topic tutorial # 5C: log metadata

Source: Internet
Author: User

Log metadata is the third part of the five tutorials for creating WordPress Themes from scratch. Today we will begin to explain the log metadata (postmetadata): date, category ), author (author), number of comments, and other log-related information.

Also open the XAMPP, theme folder, browser, and index. php file.

Let's first review the following information in the index. php file:CodeNow:

Copy the code in postmetadata.txt to <? PHP the_content ();?> Below. (Note: In this part, we only need to copy and paste. When I create a WordPress topic, I just copy and paste the code. You don't need to fully understand this part of the code, as long as you know what each part is doing .)

The following screen only crops a part of the log to adapt to the log size. It focuses on the location of the log metadata code:

Save and refresh the browser. Now it should be:

You can also viewSource codeWhat is the log metadata?

Explanation:

<P class = "postmetadata"> and </P>-all log metadata is included in the section label of class = "postmetadata, because I want to separate the log metadata from the log Content. If there is no paragraph tag, the log metadata will continue at the end of the log content, so there is no spacing to distinguish the content and log metadata.

<? PHP _ E ('filed under: ');?> -: Indicates the code that calls the colon;
Put filed under: into <? PHP _ E ('');?> It is not necessary to make the filed under: translable. If your topic does not support multiple languages, you can simply enter filed under :;

<? PHP the_category (',')?> -The_category () is used to call all types of PHP functions of logs. If you put filed under: And the_category () together, you can get: filed under: name of Category 1, name of Category 2. The comma in the_category () is used to partition the category alias. Back to the log metadata screen, we can notice the comma in the category connection;

<? PHP _ E ('by');?> -Same as filed under. If you create a private topic, the _ E () outside by is not required. _ E () is used to create a topic that can be translated. If the topic is used by hundreds of people from different countries, this is very important. If you create a topic for public use, add _ E () to the end so that your topic can be translated.

<? PHP the_author ();?> -It is the name of the output current log author.

<Br/>-if you want an empty row and do not want to use paragraph labels to generate line spacing, use BR. Note the slash /. This is a self-closing label.

<? PHP comments_popup_link ('no comments» ', '1 comment»', '% comments»');?> -When the pop-up message function is activated, comments_popup_link () calls a pop-up message window. If not activated, comments_popup_link () simply displays the message list. No Comments» is displayed when there is no message. 1 comment» is used when there is only one message. % Comments & 187; is used when there are more than one message. For example, 8 Comments ». % Is used to display numbers .» Is used to display a double arrow ».

<? PHP edit_post_link ('edit', '|', ");?> -This is only visible when we log on as an administrator or author. Edit_post_link () is just a simple display of a link that can be used to edit the current log, so that we don't have to go to the management interface to search for this log to edit it directly. Edit_post_link () has three parameters. The first is to determine which word you will use to edit the link title. If you use Edit post, edit post instead of edit is displayed. The second parameter is used to display the characters before the link. Here it is a vertical line |, and the code is & 124 ;. The third parameter is used to display the characters after the editing link, which is not used here.

After logging on to WordPress, you can return to the home page to see the "edit" link and a vertical line.

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.