• Resolved gggt

    (@gggt)


    Using “Insert custom code” with PHP, echoed strings always appear at top of editable content no matter where shortcode is placed within the editable page body. (nb return is being called at end in custom code as emphasised in documentation)

    “Insert custom code” with HTML inserts in correct location on page as expected.

    https://www.ads-software.com/extend/plugins/shortcodes-pro/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Diogo15

    (@diogo15)

    I think it is your fault(or your theme), cuz you are calling “THE_CONTENT()” before the loop start.. so your “echo” always show up at the start of the loop..

    Plugin Author Matt

    (@sksmatt)

    Hi gggt,

    You should return the strings too. Consider returning a custom variable with the collection of your output. This is the way to get your code on the right place:

    $out = "Starting my output";
    
    $out .= " Adding another string";
    
    return $out;

    Kind Regards!

    theshae

    (@theshae)

    I dont understand how to get this working.

    I am using the below code to show some posts.
    query_posts('category_name=breaking-news');

    How do I get the post to show where the shortcode is placed in the content?

    like gggt mine shows at the bottom.

    Plugin Author Matt

    (@sksmatt)

    Hi Thesahe,

    Same as above, return a custom variable with the collection of your output. Return is a language construct used to exit a function and give a value to the caller of the function[.].
    In this case the shortcode function.

    Kind Regards!

    Thread Starter gggt

    (@gggt)

    Just for the sake of an explicit FAQ, sksmatt is right (as you’d expect): If output is going to an unexpected place, most likely you’re using echo for output instead of collecting all your html into a variable and passing it back at the end with return (see sksmatt’s example).

    Plugin Author Matt

    (@sksmatt)

    Hi gggt,

    Thanks for helping explain it, much appreciated.

    Kind Regards!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Plugin: Shortcodes Pro] Insert custom code for php goes at top of content’ is closed to new replies.