dongzice4895 2016-10-12 22:16
浏览 42

在wordpress圈的背景图象

I am trying to get the past images as background using

  <div class="sectionrecipes" style="background-image:url('<?php the_field(background_image_detail); ?>');">

but it shows blank, i have tried with echo too

  <div class="sectionrecipes" style="background-image:url('<?php echo the_field(background_image_detail); ?>');">

I have checked on developer tool and it shows like this:

  <div class="sectionrecipes" style="background-image:url('370, Coole Swan Blue &amp; White Chocolate Custard Pie, blueberry-page, , Coole Swan Blue &amp; White Chocolate Custard Pie, image/jpeg, http://cooleswan.juvoclients.com/wp-content/uploads/blueberry-page.jpg, 1082, 527, Array');">

If I delete all the data on the developer tool like this:

  <div class="sectionrecipes" style="background-image:url('http://cooleswan.juvoclients.com/wp-content/uploads/blueberry-page.jpg');">

The image shows on the page. So How can I stop wordpress to apply the image details?

Than kyou

  • 写回答

2条回答 默认 最新

  • duanaoou4105 2016-10-12 22:20
    关注

    Your background_image_detail is no variable or string and therefore wrong syntax.
    It has to be:

    <?php the_field('background_image_detail'); ?>
    

    And you dont have to echo the_field() as it already outputs. get_field() will return the value.

    评论

报告相同问题?

悬赏问题

  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 划分vlan后不通了
  • ¥15 GDI处理通道视频时总是带有白色锯齿
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制
  • ¥15 merge函数占用内存过大
  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大