添加新的短代码

function footag_func( $atts ) {
    return "foo = {$atts['foo']}";
}
add_shortcode( 'footag', 'footag_func' );

在插件中,我们可以使用 add_shortcode 函数添加短代码。

短代码可以在任何 Wordpress 页面中使用,也可以通过将其括在方括号中来发布。

[footag]