发布定位自定义库短代码

时间:2018-06-16 11:29:05

标签: wordpress wordpress-shortcode

我正试图在我的wordpress插件中覆盖图库短代码。 我有这个代码

add_action('init','funcion_inicio');
function funcion_inicio(){
    remove_shortcode("gallery");
    add_shortcode('gallery', 'my_gallery_shortcode2');

}

function my_gallery_shortcode2($atts, $content){
    echo "custom code for gallery";
}

在我的网页内容中,我有这个内容

This is the first line in the page content
[gallery ids="4827,4825,4823,4821,4819,4817,4815"]

但是,当我在前端看到页面时,我按此顺序获取内容

custom code for gallery
This is the first line in the page content

正如我们所看到的,内容的第一行放在短代码函数的结果下。

有人能帮助我吗?

祝你好运

0 个答案:

没有答案
相关问题