WordPress.org

Support

Support » Themes and Templates » Image Transparent Background

Image Transparent Background

  • Hi!
    I have a recently created WP site and i was wondering how to lend images background with page/posts background. I want to be able to upload my PNG transparent images so their background is equal do the page/post in questions.

    My website is here: http://www.maquinas-de-dinheiro.pt/

    Regards,
    JP

Viewing 3 replies - 1 through 3 (of 3 total)
  • Setting the Featured Image as the page or post background? If I have this correct, then add to your theme’s header.php file’s body tag, code to pull in the current page/post featured image as background. First find the image url using this code:
    ‘<?php if (has_post_thumbnail( $post->ID ) ): ?>
    <?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), ‘single-post-thumbnail’ ); ?>
    <?php echo $image[0]; ?>
    <?php endif; ?>

    Then add to the body tag:
    `<body style=”background-image: url(‘<?php echo $image[0]; ?>’;>

    Its just that easy!

    Hi!
    First, thank you for your help

    I don’t want to make my image the background of any post or page. I want my image’s background to be the same as the post/page background so the image could blend better. Do you get it?

    Thanks!

    Oh, I see. Yes, now I get it. Sorry, don’t know how to achieve that 🙂

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Image Transparent Background’ is closed to new replies.
Skip to toolbar