I want to use meta url as background image.But the fact that I do not want to show “background-image:url(‘_’)” this way because if my meta value is empty.What I thought to end up in this way.

$bgimage= get_post_meta( $post->ID, 'settings_image', true );
< div style="<?php echo 'background-image: url(".wp_get_attachment_url( $bgimage )")';?>">

I think this is best way since I do not want to put extra conditional block here.Did I make mistake in catenation?

Read more here: unable to display the image meta value as background


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Related Wordpress search:

, , , ,

Wordpress related questions and answers: