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 -

sql - TSQL XML Parsing / Insert -

c# - Why won't my code write to SQL? -