Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/289.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 限制属性无效的woocommerce产品短代码_Php_Wordpress_Woocommerce_Shortcode - Fatal编程技术网

Php 限制属性无效的woocommerce产品短代码

Php 限制属性无效的woocommerce产品短代码,php,wordpress,woocommerce,shortcode,Php,Wordpress,Woocommerce,Shortcode,我正在使用woocommerce产品快捷码来创建产品列表 echo do_shortcode( '[products limit="4" columns="4" orderby="popularity" ]' ); 并从中引用它 Columns和orderby属性工作正常,但limit不起作用。 我总是返回所有产品的列表 我如何解决这个问题?可能是因为您的产品没有购买。试着试着购买几种产品。或者将popularity更改为title或其他。阅读更多关于这方面的信息 或 您可能正在使用低于3.1

我正在使用woocommerce产品快捷码来创建产品列表

echo do_shortcode( '[products limit="4" columns="4" orderby="popularity" ]' );
并从中引用它

Columns和orderby属性工作正常,但limit不起作用。 我总是返回所有产品的列表


我如何解决这个问题?

可能是因为您的产品没有购买。试着试着购买几种产品。或者将
popularity
更改为
title
或其他。阅读更多关于这方面的信息


您可能正在使用低于3.1的WooCommerce版本

使用

而不是

[products orderby="popularity" ]
应该有用


这是WooCommerce对此事的说法:

这是因为引用。使用这些:
“3”
而不是
“3”
“3”

我尝试过
[products limit=“4”columns=“4”]
,但它总是会返回所有product@ParitoshMahale
echo do_短代码('[products limit=“4”columns=“4”orderby=“id”])尝试this@ParitoshMahale嗯,你们有多少种产品?有多少产品显示在页面上,这个过滤器限制=“4”我总共有36个产品,它显示了所有36个list@ParitoshMahale通过“管理”面板创建一个新页面,并仅插入快捷代码
[products limit=“4”columns=“4”orderby=“id”]
为什么被否决?我提高了您的评级bro@NikitaDudarev谢谢:)
echo do_shortcode( '[products limit="4" columns="4" orderby="id" ]' );
[best_selling_products]
[products orderby="popularity" ]