WordPress/Mandigo/Custom Headers
From onehertz
Contents |
[edit] Custom Headers
In most cases, the simplest way to replace the default header image with your own is to overwrite the existing head.jpg (or head-1024.jpg if you're using a 1024px wide layout) in the appropriate scheme folder. However when you upgrade the theme, you will have to be careful to not overwrite your file again.
A more efficient way to use your own header image is to create a custom scheme, that won't be overwritten in the upgrade process.
The even better way is to upload your custom header images into the images/headers/ subfolder and enable the "random headers" feature on the Theme Options page. You can do this even if you have uploaded only one image, the random header feature will just pick the same picture every time. The method is also upgrade-proof since the folder doesn't get overwritten when you update the theme.
If you are in a WordPress MU environment or you can't upload to images/headers/ for some reason, see the WPMU section below for a workaround.
[edit] Header Images Dimensions
For best results, it's a good habit to have images display in their native dimensions rather than upscaled/downscaled by the browser. The following table holds the dimensions of the header image container for all width/height combinations (these can be set on the Theme Options page):
| Layout Width | |||
| standard 800px | wide 1024px | ||
| Header Height | standard | 737x226 | 961x226 |
| slim | 737x126 | 961x126 | |
[edit] Per-page Header Images
Mandigo has a feature that lets you to use a different header on certain pages.
If you wish to have a different header image on a page, all you have to do is name it after the ID (not slug) of the page on which it should be displayed, and upload it to the images/headers/ folder, eg images/headers/412.jpg if you want a custom image for post/page #412.
If possible, images should be saved as JPG only and in the appropriate dimensions mentionned above. You can retrieve a page's ID from the administration interface, under Manage, Posts/Page. If the theme can't find a custom header image, the default one is used instead. If there is more than one post on a page (index, archives, search, ...), the ID of the first post to appear on the page will be used.
[edit] Random Header Images
If the "Use random header images" option is enabled in the Theme Options page, AND a per-page header could not be found, Mandigo will use a random file from the images/headers/ folder. Valid file types are JPG, GIF, PNG and BMP.
As mentionned in the introduction, you can still enable this feature even if you have uploaded only one custom image. The theme will just keep picking the same picture, and you won't have to worry about overwriting your files when you upgrade.
[edit] Custom headers in WordPress MU environments
When using WPMU, it's not possible for the users to edit theme files or change the directory structure so the above tricks don't apply. However as of version 1.34, Mandigo will also look for custom headers in the user's uploaded files (the Media library).
In order for the theme to not pick any and all images, a file naming convention applies:
Mandigo will only look for files named mandigo_header_*.jpg where * can be either a post ID, or an arbitrary string. This lets you use both the per-page header and random header features.
The image files must have the correct name PRIOR to uploading since it's not possible to rename them once they are on the server (this is not the same as the picture title which you can change in WordPress).
[edit] Detection Mechanism
Here's a ordered breakdown of how the theme looks for and uses custom headers:
- Look in the user’s uploaded file (Media Library) for image files named mandigo_header_*.jpg
- If some files are found
- If there’s a file named after the currently displayed post ID (eg mandigo_header_1234.jpg), use it
- Otherwise, if the random header feature is enabled, pick any of the pictures and use it
- If some files are found
- If no files were found in the user’s Media library, look for pictures in the images/headers/ subfolder
- If some files are found
- If there’s a file named after the currently displayed post ID, use it
- Otherwise, if the random header feature is enabled, pick any of the pictures and use it
- If some files are found
- If no files were found in either the user’s Media library or the images/headers/ subfolder, use the default header
