[resolved] How to make an image background of a page with php (2 posts)

  1. iversoncru
    Posted 3 years ago #


    I have an image in $image, and i want to make it background of the page using php. Unfortunately im quite new to PHP...

    could anyone give me a hint or sth? :)

    thanks in advance for your time

  2. iversoncru
    Posted 3 years ago #

    Researching... i finally found some threats here it wordpress.org Support
    which allowed me to do it!

    Here is the code i have used, and works!

    	$page_id = get_the_ID();
    	$page = get_page($page_id);
    <?php $image_id = get_post_thumbnail_id(); ?>
    <?php $image_url = wp_get_attachment_image_src($image_id,'full');   ?>
    <?php $image_url[0]; ?>
    <div id="service_wrap_content" style="background:url(<?php echo $image_url[0]; ?>) no-repeat center center; height:674px ;">

Topic Closed

This topic has been closed to new replies.

About this Topic