• I am trying to write a first simple plugin. All this plugin will do is give a form in the admin area with two checkboxes, yes and no. If you select yes, then the plugin will display extra information outside of the loop. if you say no, then it hides that information.

    So what I did was make a div with the ID of wrapper and inside that div is a little info hard coded into the homepage of the site which is currently running on localhost.

    I got the plugin showing the form in the admin area, it is activated. I have tried a few methods to getting this to work, this is just the latest.

    On the homepage where I want the action to take place I have this code

    <code><?php if(function_exists('my_plugin_options')) { showing(); } ?></code>

    so what I was wanting was that when the no box was ticked, it would use jquery to hide the wrapper. Simple. But I can’t get the form to communicate with the homepage.

    So here is the code for the plugin, it is only 76 lines.

    https://wordpress.pastebin.com/6WbzpCsg

    below the function call on the index page, I have the wrapper with the code I want to hide.

Viewing 4 replies - 1 through 4 (of 4 total)
  • After seeing that code, I think you need more understanding on how plugins, actions and filters work. Read more lessons and also check codex documentation.

    You need to rewrite that whole thing if you want it to work like you want.

    Thread Starter cybershot

    (@cybershot)

    yes, I know that it isn’t working because of the code. The codex isn’t helpful for me because it isn’t written for beginners. There is to much information spread out over to many places. To many links to click on that take you to another page that you have to read in order for the information on the last page to make sense.

    I have checked all the documentation I can find. That is how I got as far as I did. I came in here to post to see if you can tell me what “hooks” I might be missing.

    Thread Starter cybershot

    (@cybershot)

    nope, been there done that. it is the wrong kind of tutuorial. Yes it will get you part of the way there. Remember, the code I have shown you is just one version of many. It is only after searching the web that I decided to come here asking for help. I was actually just thinking about that tutorial as I was walking to my computer. So that is funny. I tried to use a filter to find the #wrapper and then use the javascript to hide it. But I am not sure that the php was communicating with my form. That is why the form has the alert() function to let me know that it is picking up the fact that one of the boxes is checked

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘help with first plugin’ is closed to new replies.