Support » Plugins » Hacks » Display plugin-generated HTML in a Page

  • Greetings fellows !

    I am very new to WordPress and I developed a plugin which replaces the content of a whole page with HTML generated by another application.

    The thing is, right now, I need this plugin to also be able to display snippets of HTML into a big page (only a sidebar for instance), and everything else to be natively generated by WordPress means (the page editor and such).

    I failed to find such a thing, if it does indeed exist… but do we have a way to inject HTML into pages ?

    Thanks for helping !

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator bcworkz


    Yes we do, a number of ways. Where is this HTML coming from? Where does it get inserted? Perhaps the most straight forward approach would be to create a template tag (php fucntion call) to be placed at the appropriate location on the appropriate template. Then your tag function does the heavy lifting of getting and formatting the data into HTML content. The final content is then echoed out, effectively replacing the template tag on the page.

    If you actually want a sidebar, there already is a template tag, get_sidebar();

    You can also use shortcodes:

    To get it to work in Widgets in the Sidebar, use this code:

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Display plugin-generated HTML in a Page’ is closed to new replies.