I basically want to create a table (preferably AJAXified) that lets the user enter a line of information, and be able to add new lines of information, and delete selected ones.
I’ve found this post and this post. The design side looks very straightforward, but I want to know about the functionality. How do I go about adding the field contents to the database and summoning them back up? How do I get that page “plugged in” to WordPress as a whole? I have literally no idea where to start.
I’m coming from the perspective of someone who’s confident in HTML & CSS, and fairly so with JS/jQuery, but basically just hacks up PHP code that he finds around.
Any help would be appreciated, even up to telling me that it’s beyond me right now, and to go play with X plugin. FWIW, I was considering doing this with a custom post type, or the Magic Fields plugin, but I wanted a more user-friendly experience.
Many thanks!
I pretty much started in the same place as you a while back, and have created something similar. Here’s what I think you need to know.
1) Work out how to create your basic hello world first and foremost. A simple plugin will consist of a few comments at the top of a PHP file dropped into your plugins directory. Notice the variable calling the class which gets it moving. Constructor of the class calls add_top_level_menu, when this is clicked on (see $function variable) the display_page() function gets kicked off starting to build out your page.
2) Once you’ve created internal functions to return your data, whatever that may be. (use global wordpress data functions, e.g. $wpdb->get_results($sql).
3) AJAX inside the admin is a bit different to how you normally use it. All wordpress AJAX calls hook into admin-ajax.php. I found this: http://www.garyc40.com/2010/03/5-tips-for-using-ajax-in-wordpress/#js-global quite good at explaining things.
4) If you are creating tables: something like the below will do the work for you. search for dbDelta in the codex.
Hey there, I would suggest WPAlchemy MetaBoxes. Very easy to use, and it should help with what you are after.
However keep in mind it’s not yet a plugin, so you will not have a ‘one click setup’ to begin.
http://www.farinspace.com/wpalchemy-metabox/