How to set special WordPress image (FeaturedImage)

Source: Internet
Author: User
WordPress's special image (FeaturedImage) is a very convenient feature. in the past, to set a thumbnail for each article, we used scripts to match the first or last image in the article, you can also use the attachment method to retrieve images. with the special image function, everything is simple. Add the following code to the topic's functions. php: //

WordPressFeatured Image)It is a very convenient function. in the past, to set a thumbnail for each article, we needed to use a script to match the first or last image in the article, or obtain the image through attachments, with the special image function, everything is simple.

How to enable the special image function

Add the following code to the topic functions. php:

// Make WordPress support post thumbnail
If (function_exists ('add _ theme_support ')){
Add_theme_support ('post-thumbnails ');
}

How to call special images

In the post template

if( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it.
the_post_thumbnail();
}
?>

You can call images of different sizes.

The_post_thumbnail ();????????????????? // No parameter. Thumbnail is called by default.
The_post_thumbnail ('thumbnail ');?????? // Thumbnail (default size: 150px x 150px max)
The_post_thumbnail ('Medium ');????????? // Medium resolution (default 300px x 300px max)
The_post_thumbnail ('large ');?????????? // Large resolution (default 640px x 640px max)
The_post_thumbnail ('full ');??????????? // Full resolution (original size uploaded)

How to modify the thumbnail size from the background

AccessBackground> Settings> MediaThe Thumbnail size is the size of the special Image (Featured Image or Thumbnail), that is, the size of the Image called when the_post_thumbnail () is not added. Modify the parameters as needed. When uploading an image, WordPress will customize the size of the image.

Three methods for adding special images to an article

There are three ways to add features when editing an article

1. click"As a special image", As shown in. click to display"Complete"Indicates that the setting is successful. The set special image is displayed in the column on the right.

2. click special image settings in the column on the right, as shown in, and click"Set special imagesThe interface with Method 1 is displayed, and the setting method is the same:

3. if you do not use the above two methods, you may want to select a special image from the existing image in the article. WordPress is considerate, you can easily select an existing image in the text.

ClickSet special imagesButton. the following dialog box is displayed.Album, You can see all the inserted images in the text, click to display the same interface as method 1, set according to the method.

New features of WordPress 3.5

The media upload tool of WordPress 3.5 is user-friendly, easy to understand, and has better performance. if you have not upgraded it, please prepare for it.

In WordPress 3.5, it is easier to set a special image. The image is displayed in the form of a thumbnail list. to set the image as a special image, you only need to click it. the image set as a special image will be √.

You can use the drop-down list to view all the files in the media library, or view only the attachments of the current article. The search function is more powerful. you only need to enter keywords to display the search results in the form of a refreshing page.

Application of special images

Special images can be used in many places, such

  • Homepage slides
  • As a thumbnail of the special content (Featued Post)
  • This site uses special images to make thumbnails of relevant articles. let's take a look at the results below.

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.