我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

将内容插入WooCommerce循环

I have a 12 product per page loop and I am looking for a way to insert some content into the existing loop without breaking it, between product 4 and 5, between product 11 and 12 and so on.

Is there any if function like

if (loop=4){
    //get some content
}

It is stored in the global variable $woocommerce_loop so your condition would look like

// do something every 4th product
global $woocommerce_loop
if ($woocommerce_loop % 4 == 0){
  //get some content
}

近期文章

  • PHP如果SQL计数的条件语句
  • WooCommerce分页与自定义循环
  • Cakephp为整个项目切换数据库连接
  • 如何根据搜索提取每个用户的帖子
  • (PDO,PHP)使用预准备语句将多个数据从数组插入到数据库中
  • CodeIgniter链接到另一个页面/控制器
  • 使用Ajax加载更新数据不起作用
  • 来自具有缩进的对象/数组的PHP XML序列化(替换pear / XML_serializer)
  • yii1与url-manager分页
  • 显示聊天消息时出错
  • 将多个表连接在一起
  • 使用会话codeigniter时出错
  • 从sql [duplicate]中的表中检索前n个字母
  • 将参数$ argv从html表单传递给脚本
  • 如何在分隔符内分解子分隔符?
  • 在single.php wordpress上设置子类别
  • 无法在php中的excel中导出数据库信息的最后一行
  • 获得倒数第二个评论php woocommerce跟进电子邮件
  • 如何在laravel中使用make :: view或redirect来打开一个新的选项卡/窗口?
  • MYSQL SELECT与COUNT,FROM,WHERE,GROUP BY跳过第一行返回

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华