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

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

javascript - Which segment of a polyline was clicked? -

c# - Avoiding duplicate methods for Task and Task<T> -