• Resolved Eric McNiece

    (@emcniece)


    Hi, thanks for sharing your work. There’s an issue with the shortcode function – it’s a classic mistake and easy to fix.

    Shortcodes are executed/printed before the rest of the page contents. That means if the page with the [sitemap] shortcode contains any text, it will only be displayed after the sitemap output regardless of where the shortcode is placed. That’s a problem, because I wanted to put a title above the sitemap output!

    The solution is to load all of the shortcode output into a variable and return the contents instead of echoing directly in the shortcode. This way, the contents will appear in the desired location and text can be wrapped around the output.

    I’ve reformatted the add_shortcode() function to do precisely this. I would highly recommend switching over to this format for your future updates!

    https://pastebin.com/T7grih6W

    Best of luck ??

    https://www.ads-software.com/extend/plugins/advanced-sitemap-generator/

Viewing 1 replies (of 1 total)
  • Deepak Tripathi

    (@deepaktripathi19)

    Hello,

    Thanks, i have implemented it on my new version 1.0.4


    Thanks & Regards
    Deepak Tripathi

Viewing 1 replies (of 1 total)
  • The topic ‘Shortcode output appears before other page text’ is closed to new replies.