警告:缺少shortcode_atts()的参数2

时间:2013-11-22 18:58:07

标签: wordpress arguments shortcode

我在本地建立了一个网站,一切似乎都运转正常。当我将它全部迁移到测试服务器时,我的一些短代码出错了。

有问题的两个短代码如下:

function gallery_image( $atts, $content = null ) {
extract( shortcode_atts(
$atts ) );
return '<div class="twocol"><a rel="prettyPhoto[gal]" href="'. $link .'"><img src="' .     do_shortcode($content) . '"/></a></div>';
}
add_shortcode('image', 'gallery_image');

我正在使用“[show_info date =”11月。 4,2013“by =”William Shakespeare“]”执行此操作。

function show_opening( $atts, $content = null ) {
extract( shortcode_atts(
$atts ) );
return '<div class="show-opening"><span>On Stage:</span> '. $date .'<span>by:</span> ' .     $by . '</div>'; 
}
add_shortcode('show_info', 'show_opening');

我正在使用“[image link =”/ wp-content / uploads / 2013/11 / RomeoAndJuliet-Gallery01.jpg“] / wp-content / uploads / 2013/11 / RomeoAndJuliet-Gallery01.jpg [/ image ]“执行此操作。

我以前从未见过这个,也无法理解为什么它在本地工作正常,但只在加载到Web服务器后才显示此错误。知道为什么会这样吗?或者有关如何修复它的任何建议?

谢谢!

1 个答案:

答案 0 :(得分:1)

您需要在第一个参数中传递支持的属性及其默认值...

Read more