How to add your own images to the WordPress theme twentyeleven header and switch randomly

Source: Internet
Author: User

When we use the theme twentyeleven, we want to use our own photos and random header photos, which cannot be achieved through the background submission, so we need to submit and modify the photos ourselves.CodeIt is very simple. Please do not spray it, because I just want to make a record for later use.


Step 1: Prepare the image:

Two formats (one is 1000*288 and the other is 230*66) must be prepared for each image)

Assume that 1000*288 of the image name is rocco.jpg, then 230*66 of the image name is: rocco-thumbnail.jpg

Part 2: Upload to WP-content/themes/twentyeleven/images/headers/

Part 3: modify the code:

Code modification: Wp-content/themes/twentyeleven/functions. php


Modify the function: register_default_headers. Add the following content:

 
'Rocco' => array ('url' => '% S/images/headers/rocco.jpg ', 'thumbnail _ url' => '% S/images/headers/rocco-thumbnail.jpg',/* Translators: Header Image Description */'description' => _ ('rocco ', 'twentyeleven '))


Note the comma.

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.