php - Setting default value as empty on custom meta box when no value input? -


i have series of custom meta boxes configured per code below. works fine, when value hasn't been entered user, default value in boxes ". of course issue prints out on front end. if default blank nothing output on front end.

any ideas?

$video_url_1  = isset( $values['cf_private_meta_box_video_url_1'] ) ? esc_attr( $values['cf_private_meta_box_video_url_1'][0] ) : ”; $video_caption_1  = isset( $values['cf_private_meta_box_video_caption_1'] ) ? esc_attr( $values['cf_private_meta_box_video_caption_1'][0] ) : ”;  <label for="cf_private_meta_box_video_url">video url 1</label> <input type="text" class="widefat" name="cf_private_meta_box_video_url_1" id="cf_private_meta_box_video_url_1" value="<?php echo $video_url_1; ?>" /> <label for="cf_private_meta_box_video_caption">video caption 1</label> <input type="text" class="widefat" name="cf_private_meta_box_video_caption_1" id="cf_private_meta_box_video_caption_1" value="<?php echo $video_caption_1; ?>" /> 

you using character , isn't valid php syntax. php interpolating literal character . change 2 single quotes, 2 double quotes, or null. ie;

isset(...) ? esc_attr(...) : ''; 

or

isset(...) ? esc_attr(...) : ""; 

or

isset(...) ? esc_attr(...) : null; 

all 3 valid php syntax


Comments

Popular posts from this blog

How to run C# code using mono without Xamarin in Android? -

c# - SharpSsh Command Execution -

python - Specify path of savefig with pylab or matplotlib -