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
Post a Comment