• Resolved minimals

    (@minimals)


    Hi,
    I use Tailor normaly, but for example when I put a external shortoce… like this
    pluginindex.php

    function wp_first_shortcode()
    {
        echo "Hello, This is your another shortcode!";
    }
    add_shortcode('first', 'wp_first_shortcode');

    I use [first] on any page and show correctly the print, but when I use on page with Tailor, the content broke and the preview mode show The template for view579 could not be refreshed. How can I fix this?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Andrew Worsfold

    (@andrewworsfold)

    Hi @minimals

    When you add the shortcode, are you using a self-closing version (i.e., [first/]) or, as you suggest above, [first]?

    Is anything showing up in the console (right click on the page > Inspect) when this happens?

    Cheers,
    Andrew.

    Thread Starter minimals

    (@minimals)

    Hi Andrew,
    If use only [first] or [first][/first], when I inspect the page, the shortcode is printed outside the tailor div.
    The way I have found to solve this issues was add this:

    function wp_first_shortcode()
    {
        ob_start(); // add this
        echo "Hello, This is your another shortcode!"; // do something
        return ob_get_clean(); // and this..
    }
    add_shortcode('first', 'wp_first_shortcode');
    

    With this tow lines, the tailor preview works correctly and the shortcode prints inside the div.
    Thanks anyway!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘External shortcode not displaying correctly’ is closed to new replies.