• Resolved gabidedo

    (@gabidedo)


    Hi everyone,

    First of all, i’m an absolutly nob in PHP. Once I’ve said that… Is there any way to define the background imagen url of a div using PHP? I create a type image field in my new block, but I only need the url as background, not to show the image itself. How can I do it?

    Thanks!

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • tobyschmidt

    (@tobyschmidt)

    Hi gabidedo,

    you need to set the background with an inline style:
    `<div style=’background-image: <?php echo esc_url( $attributes[‘control_name’][‘url’] ); ?>’>YOUR DIV CONTENT</div>

    Maybe the syntax is not correct, writing code on a phone can be difficult ??

Viewing 1 replies (of 1 total)
  • The topic ‘Background image in PHP’ is closed to new replies.