我正在制作woocommerce的内容产品,并在模板中作为echo do_shortcode (\'[product_attribute attribute="Grams"]\');
其中Grams作为属性在我的后端,它有值,但没有输出任何内容。这是一个错误的查询还是我需要做其他事情?
shortcode not working
1 个回复
SO网友:mantis
我可能已经发现了问题(从product_attribute)
array(
\'per_page\' => \'12\',
\'columns\' => \'4\',
\'orderby\' => \'title\',
\'order\' => \'asc\',
\'attribute\' => \'asc\',
\'filter\' => \'asc\'
)
[product_attribute attribute=\'color\' filter=\'black\']
注意,attibute是单引号,而您的attibute是双引号:do_shortcode (\'[product_attribute attribute="Grams"]\');
此外,您可能需要小写字母。从…起The codex:
重要提示-不要对$atts属性名称使用camelCase或大写$atts值在shortcode\\u atts(数组(\'attr\\u 1\'=>\'attr\\u 1 default\',/…等),$atts)处理过程中使用小写,因此您可能只需要使用小写。
结束