How to use Wordpress Plugins with PHP

Discussion in 'HTML & Website Design' started by Zero2HeroBlogger, Jul 24, 2009.

  1. #1
    Ok so I want to use the plugin "wp-polls.php" except I don't want to use it as a plug and play widget. Instead I want to execute somewhere else in the page other than the sidebar. So I need to call the function using PHP right.

    My question is, how can I call the function from the plugin directory since the theme is in .../wp-content/themes/mytheme/index.php
    and the plugin is in .../wp-content/plugins/myplugin/wp-polls.php
     
    Zero2HeroBlogger, Jul 24, 2009 IP
  2. forumhelper

    forumhelper Peon

    Messages:
    13
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    If you want to include the wp-polls.php in any file, you can reference its absolute path:

    
    require_once($_SERVER['DOCUMENT_ROOT'].INSTALL_DIRECTORY."/wp-content/plugins/myplugin/wp-polls.php");
    
    Code (markup):
    INSTALL_DIRECTORY in the above code would be the string or variable holding the value of the install directory. You can leave this out if you have installed Wordpress into your website root.
     
    forumhelper, Jul 25, 2009 IP
  3. HighRankingSEO

    HighRankingSEO Well-Known Member

    Messages:
    423
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    125
    #3
    HighRankingSEO, Jul 25, 2009 IP