WordPress.org

Support

Support » How-To and Troubleshooting » Shortcode moving to top of entry content

Shortcode moving to top of entry content

  • I’ve made a custom gallery shortcode that loads all the attached images for a post and everything seems to be working fine except that the shortcode won’t stay put within the entry content. No matter where I enter the shortcode when authoring a post all the returned images shows at the top of the post.

    The other shortcodes I’ve made execute in-place and leave the output code in the same place the original shortcode was placed. Anyone have any ideas what would cause this one to move itself to the top?

Viewing 1 replies (of 1 total)
  • Found the problem. My function echoed out a bunch of content and instead I had to save all the content as variables and use a return.

    so instead of:

    echo “content”;
    echo “other content”;

    it became

    $variable.=”content”;
    $variable.=” other content”;
    return $variable

Viewing 1 replies (of 1 total)
  • The topic ‘Shortcode moving to top of entry content’ is closed to new replies.