php - What's wrong with this line? Setting dynamic url background -


i'm trying dinamically add background inside css using php, using wordpress post image.

background: <?php if(has_post_thumbnail()){                  $img = wp_get_attachment_image_src(get_post_thumbnail_id($post->id), 'destacados');                 echo 'url(".$img['0'].") no-repeat center'  } ?>; 

background: <?php if(has_post_thumbnail()){                  $img = wp_get_attachment_image_src(get_post_thumbnail_id($post->id), 'destacados');                 echo "url('".$img['0']."') no-repeat center";              } ?>; 

the quotes wrong , semicolon missing.


Comments

Popular posts from this blog

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

php - render data via PDO::FETCH_FUNC vs loop -

The canvas has been tainted by cross-origin data in chrome only -