Use Wordpress custom columns to mark Article sources

Source: Internet
Author: User

If wordpress is used as an information website, it usually involves posting or reprinting articles from other sites. We need to mark the article source. Because the page is beautiful, it is generally indicated under the title of the article body. You can use the custom topic of wordpress.

1. in the upper-right corner of the wordpress background article writing page, click "show options" as shown in, and check the "Custom columns" option in the pulled menu.

 

2. The "Custom topic" editing menu is added under the article editing box. Enter "author" in the name (other English letters are also supported ). Enter the author name in the value.

 

3. Next, set this value on the document page. Add the following to the code corresponding to the title in single. php:

<? Php echo get_post_meta ($ post-> ID, "author", true );? >

If this option is not available in the previous article, we can make a judgment:

<? Php $ author = get_post_meta ($ post-> ID, 'author', true); if ($ author) {echo "$ author";} else echo "fun "? >

In this case, "Quba" is output directly when no corresponding value exists ". The effect is as follows:

 

Author: Fun: http://www.vxin78.com/reprint please note!

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.