Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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);
share|improve this question
add comment

marked as duplicate by toscho Aug 1 '12 at 22:21

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer

up vote 0 down vote accepted

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

share|improve this answer
    
Thanks, it now shows correctly with return. :) –  Ryu Aug 1 '12 at 22:19
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.