miniCarl
Member
Posted 1 year ago #
In editor, I write the following content:
Lorem ipsum sample text blablabla
Then some [shortcode at the very bottom]
However, when i view the page, the generated content from the shortcode is viewed at the top of the page. Note that this is not a css error, since i viewed the source of the generated page and also there is the shortcode stuff at the top.
what shortcode?
all shortcodes?
self-made short code?
what is the full code of the shortcode function?
link?
I experienced this situation myself. This is clearly explained directly on the Codex page for short code functions:
http://codex.wordpress.org/Shortcode_API#Output
"The return value of a shortcode handler function is inserted into the post content output in place of the shortcode macro. Remember to use return and not echo - anything that is echoed will be output to the browser, but it won't appear in the correct place on the page."
So instead of doing echo "stuff"; just return all that you want outputted as a string:
$string = "stuff";
return $string;
But I guess after 3 months of everyone failing to point out this simple fact you may have figured it out on your own already :P