Php Wordpress,是否可以将自定义参数添加到任何小部件的快捷编码中

Php Wordpress,是否可以将自定义参数添加到任何小部件的快捷编码中,php,wordpress,shortcode,Php,Wordpress,Shortcode,我正在使用插件。是否可以将属性发送到使用shortocde调用的小部件。像这样的 [do_widget name="Category Viewer" maxcount=5] 其中,maxcount参数应在类别查看器小部件中使用。您可以通过查看该插件中的以下代码来检查“任何小部件的短代码”短代码使用的属性: extract(shortcode_atts(array( 'sidebar' => 'Widgets for Shortcodes', 'id' =&

我正在使用插件。是否可以将属性发送到使用shortocde调用的小部件。像这样的

[do_widget name="Category Viewer" maxcount=5]

其中,maxcount参数应在类别查看器小部件中使用。

您可以通过查看该插件中的以下代码来检查“任何小部件的短代码”短代码使用的属性:

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”从shortcode中提取

您必须修改上面的插件代码,通过向数组添加maxcount索引来支持此属性


有关如何使用shortcode属性的更多信息,请查看,我认为有一些秘密方法可以实现这一点,比如调用add_shorcode函数或类似的东西,因为我希望避免更新side插件。但这似乎是唯一的办法。谢谢