Change background for different post categories
URL to the page in question:
-
Hi Bill,
Is it possible to change the background image for ‘normal’ posts by category (ie, design, build, etc) or even by individual post?
(I’m not using the Services feature, so can’t use service-groups approach)
I saw in another post about using the featured image but that made no difference to me.
FYI – Slide Enabled = Yes, One slide background image.
Thanks,
Eddie
Eddie,
Good question. The way to go about doing that without any editing, would be to use the same featured image for every post in a category. If you set the featured image and also choose the “Image” format, the featured image will be displayed in the background.
If you’d like to do that programmatically, it can be done. Here’s what you’ll need to do:
- Go to the Media section of your WordPress control panel and select Add New.
- Upload the image you’d like to use for your category background. Once the upload finishes, WordPress will give you the URL to that image. Copy it.
- Next go to the Appearance section and select Edit.
- From the list of files on your right, choose custom-js.php
- Look for this spot:
<?php elseif (is_archive() && of_get_option('archive_image', $single = true) != "" ): ?>
{image : '<?php echo of_get_option('archive_image'); ?>'}
- Right above that paste this:
- Change
Blog
to the name of the category you’re working with. The change the http://www.organizedthemes.com/demo/foxy/files/2011/08/cafe.jpg to the URL of your image you copied earlier.
- Save your changes.
That should give you a consistent background image for that category. You can repeat that for as many categories as you need to.
If a post is in more than one category, I believe this will show the image for the first one you have listed in your code here.
If you have any questions or trouble, just let me know,
Bill
- The topic ‘Change background for different post categories’ is closed to new replies.