WordPress.org

Ready to get started?Download WordPress

Forums

Display plugin-generated HTML in a Page (3 posts)

  1. plaristote
    Member
    Posted 1 year ago #

    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 !

  2. bcworkz
    Member
    Posted 1 year ago #

    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();

  3. yakbrother
    Member
    Posted 1 year ago #

    You can also use shortcodes: http://codex.wordpress.org/Shortcode_API

    To get it to work in Widgets in the Sidebar, use this code:
    http://www.wprecipes.com/how-to-add-shortcodes-in-sidebar-widgets

Topic Closed

This topic has been closed to new replies.

About this Topic