• Resolved Luke

    (@lukejanicke)


    I am writing a custom image shortcode. I would like to use the shortcode [image]. It doesn’t seem to be an existing shortcode. It isn’t defined in the core WordPress file where (for example) the [gallery] shortcode is defined.

    However, when I implement and use the [image] shortcode, all the images are moved to the top of my post, before all the text content.

    Here’s some raw blog text…

    A friend of mine, knowing that I often went jogging, had forwarded me a link for an upcoming event out on the Inner-Mongolian grasslands and thought I might be interested. Do bears do number-2s in the forest? Yes, I was interested. I was extremely keen indeed.

    [image id=”372″]

    A couple of other colleagues showed interest, and before we knew it, we had booked time off from work, signed up and paid our 100RMB deposits for a 10km cross-country race out in the grasslands for 6-months later.

    The paragraphs and images go on like that. However, when the post is viewed, all the images are moved to the top, before all the text.

    WTF?

    Anyone know why?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter Luke

    (@lukejanicke)

    Update: I changed the shortcode name to [newsimage] in functions.php and updated the shortcodes in the post text and… the same phenonema is still happening. So, I guess that rules out a clash with some existing internal [image] shortcode.

    Why would a simple shortcode pull the content to the top of the post?

    Thread Starter Luke

    (@lukejanicke)

    I got it. The function for the shortcode needs to return the output, not echo/printf it.

    Could you share your shortcode function? sounds like it could be handy.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘'image' shortcode?’ is closed to new replies.