我定义了以下字段类型:
array(
'type' => 'attach_image',
'heading' => esc_html__("Add background image"),
'param_name' => 'background_image',
'description' => 'Add a background image to this section.',
'value' => __(''),
)
并在变量中定义短代码参数
extract(
shortcode_atts(
array(
'background_image'=> '',
),
$atts
)
);
我试图让附加图像的src
andalt
显示为背景图像:
<div class="hero" style="background-image:url(<?php echo $background_image; ?>);></div>
但是,background-image:url()
显示为空?