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.