WordPress.org

Ready to get started?Download WordPress

Forums

Image Transparent Background (4 posts)

  1. jpierre70
    Member
    Posted 2 years ago #

    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

  2. flashbuddy
    Member
    Posted 2 years ago #

    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!

  3. jpierre70
    Member
    Posted 2 years ago #

    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!

  4. flashbuddy
    Member
    Posted 2 years ago #

    Oh, I see. Yes, now I get it. Sorry, don't know how to achieve that :)

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.