我有一个插件的简码,我无法修改...这个简码有一些参数。[some_shortcode value=""] - 我尝试输入来自 post meta 的值作为此简码的参数,但它不起作用 - 这是代码...
这是我创建的短代码的代码(它从 post meta 返回值)
function test_shortcode( $string ) {
extract( shortcode_atts( array(
'string' => 'string'
), $string));
// check what type user entered
switch ( $string ) {
case 'first':
return get_post_meta( get_the_ID(), 'post_meta_one', true );
break;
case 'second':
return get_post_meta( get_the_ID(), 'post_meta_two', true );
break;
}
}
add_shortcode('test', 'test_shortcode');
现在我想将此短代码插入我页面上插件的现有短代码中。
For example: [some_shortcode value='[test string="first"]']
它不是这样工作的。感谢帮助!