Insert a plugin manually into wordpress page

I am working in worpress front page.

I want to add a plugin to the page at a specific location manually but adding the code to the page myself.

Read More

I basically want to include a plugin in a certain page on a certain location. So I’m create a div…

<div id="plugin-holder">
     **Plugin-will-appear-here-with-this-code**
</div>

Don’t anyone know how this is done please?

Thanks

Related posts

Leave a Reply

3 comments

  1. If you’re wanting a plugin to appear somewhere, you’ll be looking for “shortcode” functionality.

    This is actually surprisingly easy to code, check out the examples in the Codex under Shortcode API – ie:

    function bartag_func( $atts ) {
        // ... do more things here ...
    return "text to replace shortcode";
    }
    add_shortcode( 'bartag', 'bartag_func' );
    

    Once you’ve called these functions you can use [bartag] in code and it will run your function and replace the shortcode with the generated text your function returns.

    If you’re adding shortcode functionality to your site, it generally makes most sense to code a really simple plugin and put it in that. The reason why this works best is that, over time, it’s really easy to forget and upgrade a theme by mistake (or even change to a new theme) and thus break your site by losing your custom code in your former functions.php. Surprisingly, this is pretty easy to achieve and only requires some specially formatted comments at the top of your plugin file and a little common sense in coding – there are many tutorials and “how to”s around!

    Here’s a useful shortcode tutorial: http://www.reallyeffective.co.uk/archives/2009/06/22/how-to-code-your-own-wordpress-shortcode-plugin-tutorial-part-1/

  2. You should add the relevant plugin code to functions.php.

    I suspect you’ll want to use some conditional tags, like is_home() to pinpoint your location. But maybe not, depending on what you are trying to do,

    Also, if you’re trying to to insert from a pre-existing plug-in, make sure you remove the register_activation_hook or activate_pluginname action.

  3. If your plugin supports a sidebar widget you can simply “widgitize” the div tag that you wish to insert the plugin into.. Google the term and you are gonna find many resources.