WordPress.org

Support

Support » Themes and Templates » Using Featured Image as background art… need diff image for thumbnail?

Using Featured Image as background art… need diff image for thumbnail?

  • jasonsherwin
    Member

    @jasonsherwin

    Hey Guys,

    So I’m using the new ‘featured image’ feature to specify alternate background art for some pages.

    I also would like to have thumbnails for these pages with different artwork. And I don’t want either of these images to show up when I pull all the images uploaded for that page to use as a gallery on the page.

    I can’t think of any clean way to achieve this…

    It’s easy to exclude the featured image from these gallery results… but what about the thumbnail image?

    I’d prefer not to modify the db…

    Any thoughts?

Viewing 2 replies - 1 through 2 (of 2 total)
  • How about using a page or post custom field ‘bg_image_url’ for the background images, upload the images in the media section so they are not associated with the post. Copy the image url and save it in a custom field.

    Then just set this in the header.php file.

    <?php $pagebg = htmlspecialchars( get_post_meta( $post->ID, 'bg_image_url', true )); ?>
    
    <?php if($pagebg) : ?>
       <body style="background-image: url('<?php echo $pagebg; ?>')">
    <?php else : ?>
    <body <?php body_class(); ?>>
    <?php endif; ?>

    Untested code but should work!

    David

    jasonsherwin
    Member

    @jasonsherwin

    Hey Adeptris,

    Thanks for the tip.

    I played around with this a bit earlier but ended up going with this awesome cms plugin called magic fields instead:
    http://wordpress.org/extend/plugins/magic-fields/

    If it was gonna just be me updating the site I’d have gone with your solution above and avoided using a huge plugin for something like this… But this stuff’s gotta be super simple and straighforward on the backend… the less steps the better!

    This plugin gives them 2 pretty upload forms so it’s quick and easy.

    thanks again,

    -jason

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Using Featured Image as background art… need diff image for thumbnail?’ is closed to new replies.