我正在尝试使用
将过去的图像作为背景 <div class="sectionrecipes" style="background-image:url('<?php the_field(background_image_detail); ?>');">
但它显示为空白,我也尝试使用echo
<div class="sectionrecipes" style="background-image:url('<?php echo the_field(background_image_detail); ?>');">
我已经检查了开发人员工具,它显示如下:
<div class="sectionrecipes" style="background-image:url('370, Coole Swan Blue & White Chocolate Custard Pie, blueberry-page, , Coole Swan Blue & White Chocolate Custard Pie, image/jpeg, http://cooleswan.juvoclients.com/wp-content/uploads/blueberry-page.jpg, 1082, 527, Array');">
如果我删除开发人员工具上的所有数据,请执行以下操作:
<div class="sectionrecipes" style="background-image:url('http://cooleswan.juvoclients.com/wp-content/uploads/blueberry-page.jpg');">
图像显示在页面上。那么如何停止wordpress来应用图像细节呢?
比kyou
答案 0 :(得分:0)
您的background_image_detail
不是变量或字符串,因此语法错误
它必须是:
<?php the_field('background_image_detail'); ?>
你不必回复the_field()
,因为它已经输出了。 get_field()
将返回值。
答案 1 :(得分:0)
在Custom Feild设置中,您需要选择“Image URL”作为返回值。它似乎当前设置为“图像对象”