Elementor 页面构建器短代码问题

Fah*_*med 5 wordpress shortcode elementor

使用 Elementor Wordpress 页面生成器时,我遇到了一个奇怪的问题。

创建自定义短代码并将其插入任何页面位置后,它也会显示在页面顶部,但仅限于编辑模式。

页面顶部:

页面顶部

我想插入短代码的地方:

我想插入短代码的地方

小智 7

一个无关网站上的答案帮助我解决了这个 Elementor 问题。https://wp-types.com/forums/topic/shortcode-output-showing-up-in-the-wrong-place/

我只需要在我的函数中包含ob_start();和$content = ob_get_clean(); return $content;。这是它的样子:

function custom_author_link_function() {
        ob_start();

        coauthors_posts_links();

        $content = ob_get_clean();
        return $content;
}
add_shortcode('custom_author_link', 'custom_author_link_function');
Run Code Online (Sandbox Code Playgroud)