The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

Shortcode moving to top of entry content (2 posts)

  1. clarklab
    Posted 6 years ago #

    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?

  2. clarklab
    Posted 6 years ago #

    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.=" other content";
    return $variable

Topic Closed

This topic has been closed to new replies.

About this Topic