• Resolved bjdavids649

    (@bjdavids649)


    At my test site, I am trying to do different backgrounds for each page.

    I have a custom field called background-image with a url from the media area.

    I have the following just have the header call and before content:

    <style type=“text/css”>
    body {
    background-image: url(‘<?php echo get_post_meta($post->ID, ‘background-image‘, true); ?>’);
    }
    </style>

    I don’t see it’s working and when I look at the code, it’s outputs:

    <style type=“text/css”>
    body {
    background-image: url(‘Array’)
    }
    </style>

    I cannot figure out what I’m doing wrong. I’ve tried Googling the answer but all information indicates I’m doing the right thing.

    Any ideas?

    Thanks,
    Barb

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter bjdavids649

    (@bjdavids649)

    I found out that my quotes around the background-image were of a difference character. I deleted them and retyped and now am seeing the right source, no more Array… except… I’m still not seeing my background? Ugh!

    Thread Starter bjdavids649

    (@bjdavids649)

    I GOT IT!

    Changed the header.php file body line to:

    <body <?php body_class(); ?> style=”background-image: url(‘<?php echo get_post_meta($post->ID, ‘background-image’, true); ?>’);”>

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Custom Field Outputting Array’ is closed to new replies.