WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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';

share|improve this question

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

This question was marked as an exact duplicate of an existing question.

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

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