• Resolved Mihael

    (@mihael)


    I have a strange problem and can not find the solution to resolve it…

    I have made a custom shortcode (simple, nothing special)…
    I inserted the shortcode like [my-shortcode] after the content of the page like this:

    #####

    some page content ….

    [my-shortcode]

    #####

    The problem is that when the page content is displayed, wordpress displayes the shortcode content first like this:

    #####

    my short code content

    some page content…

    #####

    Am I doing something wrong or is this a bug?

    Thanks!

Viewing 7 replies - 1 through 7 (of 7 total)
  • Anonymous User

    (@anonymized-3085)

    are you printing to the screen within the shortcode? or returning it?

    Thread Starter Mihael

    (@mihael)

    Printing…

    Anonymous User

    (@anonymized-3085)

    that’s why then, try returning what you want printed to the screen.

    Thread Starter Mihael

    (@mihael)

    Thanks, I figured that out now…
    I wanted to use something like this:

    <?php
    function my_shortcode() {
    
    if(somethign):
    ?>
      <html code here>
    <?php
    endif;
    
    }
    ?>

    now I have to put everything I want to output into variable and then return it… I think ??

    Anonymous User

    (@anonymized-3085)

    exactly.

    Thread Starter Mihael

    (@mihael)

    OK. Thank you very much for your time.

    dkumawat3

    (@dkumawat3)

    Works Perfect.
    Thank you very much

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Shortcode inserted after the page content gets displayed before it’ is closed to new replies.