• Hi all,

    I have developed a PHP Script that I will be using on our WordPress Installation. But I ned to know how to turn this into a plugin.

    At the moment, for the purpose of testing it… I have installed a plugin called “PHP Execution” which allows me to run PHP scripts in WordPress PAges/posts… but I don’t want to have this installed on our live site.

    What I want to do instead, is turn my PHP script into a plugin and then use an operator to call that plugin on the page of my choosing…

    Can someone tell me how this is done?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Anonymous User

    (@anonymized-3085)

    have a look at Shortcode API

    Thread Starter CBResources

    (@cbresources)

    Hi Rich & thanks for the advice…

    I took a look at that post and it was a bit too advanced for my level of WordPress knowledge.

    What I really need at this stage is a step-by-step (sort of “for dummies” guide and possibly an example).

    Literally all I want to do is call upon my plugin in a page or post by entering a “tag.”

    I know what to enter at the top of the PHP file to have wordpress recognise it as a plugin, I just don’t know how to call upon that plugin in a page?

    Anonymous User

    (@anonymized-3085)

    that is what shortcodes do.

    the basics:
    add_shortcode('my-shortcode', 'my_shortcode_handler');

    creates a shortcode for use in your blog: [my-shortcode]

    my_shortcode_handler needs to be a function. Simply put if you do something else this:

    function my_shortcode_handler(){
     include 'yourscripts.php';
    }

    then within your scripts return $string-to-print; (ie don’t echo to the screen) it would work ok. I know I’ve done this a few times when I had to adapt scripts very quickly.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Turn PHP Script into Plugin’ is closed to new replies.