Possible Duplicate:
Shortcode always displaying at the top of the page

I am using custom shortcode to show some message at the end of the post. I am finding it hard to do so because it shows up at the top of the post. Here is my code.

I am placing the shortcode at the end of the post but the message appears at the top of the post.

What should I do to fix this?

function hello_kitty(){
if ( is_single() ){
    echo 'This is hello Kitty message';
}

}
add_shortcode('hellokitty',hello_kitty);

1 Answer
1

Shortcodes are supposed to return your html, not echo it.

Make sure you check the documentation on the Shortcodes API
http://codex.wordpress.org/Shortcode_API

Leave a Reply

Your email address will not be published. Required fields are marked *