【问题标题】:How to print Google AdSense code in WordPress如何在 WordPress 中打印 Google AdSense 代码
【发布时间】:2016-04-10 22:06:05
【问题描述】:

我开发了 WordPress 主题,并计划添加 Google 广告选项,但我无法打印 Google AdSense 代码。怎么打印?

$googleads_code = get_field('custom_ads');
echo '<div class="adbox">'.$googleads_code.'</div>';

此代码无法在我的模板上打印 Google 广告。我该怎么做?

【问题讨论】:

  • 它什么都不返回:? echo get_field('custom_ads');
  • 使用 the_field('custom_ads');打印

标签: php wordpress adsense


【解决方案1】:

1) 关闭变量前的div标签

2) 使用有代码的变量

$googleads_code = get_field('custom_ads');
echo '<div class="adbox">' . $googleads_code . '</div>';

【讨论】:

  • 哦。对不起。我已经在我的代码上关闭了它。但是上面写错了。编辑它。对不起我可怜的英语。 :(
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2016-06-13
  • 1970-01-01
  • 1970-01-01
  • 2021-09-12
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多