# Post Field \> Background Image bug

**URL:** <https://forum.pinegrow.com/t/post-field-background-image-bug/5944>\
**Category:** Pinegrow WP\
**Tags:** bug\
**Created:** [November 26, 2021, 7:31pm UTC](https://forum.pinegrow.com/t/post-field-background-image-bug/5944 "2021-11-26T19:31:43Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Antzy](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/antzy/32/3790_2.png) [@Antzy](https://forum.pinegrow.com/u/Antzy)\
**Post date:** [November 26, 2021, 7:31pm UTC](https://forum.pinegrow.com/t/post-field-background-image-bug/5944/1 "2021-11-26T19:31:43Z")

</div>

I’m trying to link div with background images to wordpress. I added Post Field - Smart action to a div with a background-image, set the Field Id to a unique value and Edit as Background image.  
Now in wordpress, when I reload the page preview, I get the error:

> **Parse error** : syntax error, unexpected token “?” in **C:\xampp\htdocs\xxx\wp-content\themes\xxx\page-test.php** on line **3**

If I change the Post Field from Background image to Image or Content, it works fine. But the moment, I use Background image, get the above error.

HTML in Pinegrow:  
`<div style="height: 80vh;" cms-post-field="test" cms-post-field-type="background-image"></div>`

Generated PHP:  
`<div style="height: 80vh;background-image:<?php echo 'url('<?php echo get_template_directory_uri(); ?>/.PG_Image::getUrl( get_post_meta( get_the_ID('), 'test', true ), 'large' ).')' ?>;"></div>`

---

<div class="post-metadata">

**Author:** ![Antzy](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/antzy/32/3790_2.png) [@Antzy](https://forum.pinegrow.com/u/Antzy)\
**Post date:** [November 27, 2021, 12:42pm UTC](https://forum.pinegrow.com/t/post-field-background-image-bug/5944/2 "2021-11-27T12:42:09Z")

</div>

It works if I change the PHP code by removing the \<?php echo get\_template\_directory\_uri(); ?\> part and removing the single quote inside get\_the\_ID() function call parantheses:

`<div style="height: 80vh;background-image:<?php echo 'url('PG_Image::getUrl( get_post_meta( get_the_ID(), 'test', true ), 'large' ).')' ?>;"></div>`

But of course, it gets overwritten with the incorrect code if I save the page again from Pinegrow

---

<div class="post-metadata">

**Author:** ![matjaz](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/matjaz/32/5_2.png) [@matjaz](https://forum.pinegrow.com/u/matjaz)\
**Post date:** [December 3, 2021, 9:35pm UTC](https://forum.pinegrow.com/t/post-field-background-image-bug/5944/3 "2021-12-03T21:35:22Z")

</div>

@Antzy this is now fixed.

Try the fix now on Pinegrow Live:

> **[Pinegrow Live update log | Pinegrow Web Editor](https://pinegrow.com/download/pinegrow-live/pinegrow-live-update-log/#6-21-1-dec-1-2021)**
>
> The exciting story of Pinegrow Live updates.

---

<div class="post-metadata">

**Author:** ![Antzy](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/antzy/32/3790_2.png) [@Antzy](https://forum.pinegrow.com/u/Antzy)\
**Post date:** [December 8, 2021, 5:02am UTC](https://forum.pinegrow.com/t/post-field-background-image-bug/5944/4 "2021-12-08T05:02:37Z")

</div>

Thanks for such a quick fix! Will check the live version and update here.

---

<div class="post-metadata">

**Author:** ![Antzy](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/antzy/32/3790_2.png) [@Antzy](https://forum.pinegrow.com/u/Antzy)\
**Post date:** [December 12, 2021, 4:05am UTC](https://forum.pinegrow.com/t/post-field-background-image-bug/5944/5 "2021-12-12T04:05:54Z")

</div>

Tested and it works correctly now.
