【发布时间】:2014-07-11 11:54:47
【问题描述】:
我正在为一个运行社交赎金风格博客的客户开发一个网站。这是用户必须单击其中一个社交媒体按钮才能访问内容的地方。
但是,她现在将使用用于 wordpress 的 OnePress Social Locker 插件,该插件通过将内容包装在特定标签中来工作,如下所示:
[sociallocker] Content Here will Be Locked [/sociallocker]
目前她已经有了自己的自定义简码,其工作方式如下:
[socialLock url="http://example.com" text="Click here to view content"] Content here will be locked [/socialLock]
问题在于她的博客上有超过 2,300 个页面,并且要更改每一个 indv。通过仪表板需要很长时间,这不是按小时计酬的合同。
我认为我可以像这样将当前的简码传递给新的简码:
function parseShortcode_func( $atts ) {
$atts = shortcode_atts( array(
'link' => '',
'text' => 'default text'
), $atts );
return "[sociallocker] <a href=\"{$atts['link']}\">{$atts['text']}</a> [/sociallocker]";
}
add_shortcode( 'socialLock', 'parseShortcode_func' );
但那只是输出
[sociallocker] Click here to view content [/sociallocker]
有没有人知道如何在短代码中解析第二个短代码?
【问题讨论】:
标签: php wordpress plugins shortcode