我正在使用shortcode any widget插件。是否可以将属性发送到使用shortocde调用的窗口小部件。像这样的东西
[do_widget name="Category Viewer" maxcount=5]
其中 maxcount 参数应在类别查看器小部件中使用。
答案 0 :(得分:0)
您可以通过查看该插件中的以下代码来检查短代码“短代码”短代码使用的属性:
extract(shortcode_atts(array(
'sidebar' => 'Widgets for Shortcodes',
'id' => '',
'name' => '', /* MKM added explicit 'name' attribute. For existing users we still need to allow prev method, else too many support queries will happen */
'title' => '', /* do the default title unless they ask us not to - use string here not boolean */
'class' => 'amr_widget', /* the widget class is picked up automatically. If we want to add an additional class at the wrap level to try to match a theme, use this */
'wrap' => '' /* wrap the whole thing - title plus widget in a div - maybe the themes use a div, maybe not, maybe we want that styling, maybe not */
), $atts));
这样 - 你的maxcount属性不会通过“shortcode any widget”从短代码中提取。
您必须通过将maxcount索引添加到数组来修改上面的插件代码以支持此属性...
查看codex,了解有关如何使用短代码属性的更多信息