How to add a background image to a wordpress topic

Source: Internet
Author: User
Tags php file

There are three methods:

Method 1: modify the background attribute of the body directly in the CSS of the topic (for example, the following code ).

The code is as follows: Copy code

Body {
Background: # f2f2f2 url (images/body_bg.png) repeat-y 50% 0; // you can change it to your own image.
Margin: 0 auto;
Color: #131313;
}

Method 2: Add the background module to the topic.

Add the following code to the function. Php file of the topic:

The code is as follows: Copy code

// Add a custom background
Add_theme_support ('m M-background ');

Then, find the body tag in header. php and change it to the following code:

The code is as follows: Copy code

<Body <? Php body_class () ;?>>

In this way, the topic custom background image function is implemented. Then, you can set the background image or background color in the background.

Method 3: perform operations in the background

Add the following function to the topic's functions. Php file (if this file is not available, create one by yourself ):

The code is as follows: Copy code

Add_custom_background ();

A function enables the custom background function for your WordPress topic!

Upload background image

After completing the previous step, add the support code for the custom background feature to your topic, open the WordPress control panel, in the appearance bar, a background menu option appears. Click it to display the following setting options page:

 

As shown in the preceding figure, if you have not uploaded an image, there is only one background color selector in the displayed options column. However, if you have uploaded an image, it will be changed to the following figure:
WordPressXML (a small tool for splitting WordPress backup file xml) 1.0 green Chinese version rating:
5.0
Category: Network related size: 5.2 M language: Chinese
View Details>
Download 7 times
The setting is quite simple. [display options] has three more setting options: Background, repetition, and attachment mode, but we can still set the background color.

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.