Support » Plugins » A Cry for Help: developing a simple plugin.

  • Greetings all,

    I have come up with an idea for what I think could be a very interesting plugin, but I am having trouble integrating the already written php code into WP. Here is what I would like to do:

    — Have a menu under ‘options’ in the admin pannel that lets users set a variety of options regarding how the plugin is to perform.

    My setup would be (I think, based on what I have read in the codex): File A, the one that does all the work, File B, allows for customization of the paramters used in File A, and File C, the one that calls the customization page from WP. Does this make sense?

    Here is my sample code to call the customization page and create an options page in the admin backend (note that it doesn’t work!):

    The code goes here, but I can’t paste it! Frustrating!

    This is based on the example provided in the codex, but I sure can’t get it to work! What am I doing wrong? I’ve looked at other plugins that do this but they all seem to miles ahead of mine in complexity. This should be simple: allow users to set parameters in a menu (instead of editing them inside the php).

    The plugin itself doesn’t do anything with any wordpress variables (at the moment) but rather it is a page WP users would link to that would provide specific information for visitors. Can anyone provide any assistance or point a php/ wp novice in the right direction?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter clarke1866

    (@clarke1866)

    I have to fool WP here into allowing me to paste the code. Damn this is frustrating! I’ve replaced brackes with hyphens. Example Code:

    Plugin Name: Sample Menu Test
    Plugin URI: http://wordpress.org
    Description: Menu Test
    Author: Nobody
    Author URI: http://example.com

    function AddCrazyOptionPage
    -add_options_page-__-“Crazy Options”-, __-‘Crazy Options’-, 9, ‘somefilesomewhere’-;
    }

    Moderator James Huff

    (@macmanx)

    Volunteer Moderator

    You may want to take a a look at this. I’m not sure if it’s exactly what you’re looking for, but it is entitled “How to Write a Simple WordPress Plugin”, and it is from one of the WP Devs:

    http://www.asymptomatic.net/archives/2005/02/22/1328/how-to-write-a-simple-wordpress-plugin/

    In order to post code, enclose it with backticks; it will then not be interpreted.

    Thread Starter clarke1866

    (@clarke1866)

    I figured out that it was complaining about… here is my code:

    /*
    Plugin Name: Sample Menu Test
    Plugin URI: http://wordpress.org
    Description: Menu Test
    Author: Nobody
    Author URI: http://example.com
    */

    function AddCrazyOptionPage()
    {
    add_options_page(__("Crazy Options"), __('Crazy Options'), 9, 'somefilesomewhere');
    }

    Macmanx, thanks for the link. It is a good resource no doubt, but I doubt what I envision will need to interact with WP’s hooks and filters. It just needs to have a menu link and customization page.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘A Cry for Help: developing a simple plugin.’ is closed to new replies.