Shortcode output order

Hi! Someone must have asked this before, but I can't find it in the forum.

If I have a page with this content:

My text
[spicepress_service]

It get rendered as:

[spicepress_service]
My text

This is not what I expect. Is it possible to have my own text before the Service Section output?

Regards
Walter

Comments

  • edited July 28
    Hi, @walthy

    Thanks for contacting us!

    This is a minor issue, we are soon going to fix it. If you want we fix this from our end, you can share your admin details at my email(gamit6444@gmail.com), I will replace one of the theme file. Even if you can do it on your own I will share the code file for replacement in the directory: functions/shortcode/shortcode.php 

  • Hi!

    I looked in the file and saw the problem. The function spicepress_service_shortcode() prints directly to stdout, and does not return anything. I made an quick and dirty solution by defining a new shortcode that captures the output:

    function spicepress_service_shortcode2() {
        ob_start();
        spicepress_service_shortcode();
        return ob_get_clean();
    }
    add_shortcode('spicepress_service2', 'spicepress_service_shortcode2');

    Not well tested, but it seems to work, so I'm good. Thanks for leading me to the code! :-)

    Regards,
    Walter
  • Glad to know that your problem resolved.

    If you want to update the shortcode.php file so you can update this file code from HERE. By the way, we will update the code of the shortcode.php file in the next version.

    Thanks
This discussion has been closed.