building a plugin (have some question need support)
-
Hi im building a plugin for wordpress, is my first plugin, i have made some modules for Drupal, but this is my first contribution to wordpress.
I havent found the plugin how i need. If you think there is aplugin like this tell me and ill see it.
What im doing is a plugin that registers a widget. I called the plugin WordPress TabbedPosts widget. This plugin will show in the settings of wordpress a list with all the posts (after i will add a way of find or filter those posts), each post have in front a checkbox.
So the widget will recieve the ids of the posts that where selected with those checkboxes, and will show the posts and their content in a tab format, i mean, i tab per post, so title of the post in the tab, and if i click the tab it should show the content of the post, i can do that with jquery ui.
each checkbox have of value the id of the post infront.
now, i have the admin page of the plugin in the settings of wordpress, i have the the widget, but anything inside, just the title, in the admin page of the plugin i have the list of posts and one checkbox in front of each title post.
this is the code of the form of that list in the admin page of the plugin
<form id="form1" name="frm" action="options.php" method="POST"> <?php settings_fields('wppostabsgroup'); ?> <h1>Configuraciones de WordPress postabs</h1> <p> <h3>Seleccione los artículos que quiere mostrar en formato pesta?a</h3> </p> <table class="widefat"> <thead> <tr> <th>Título</th> <th>postabbed</th> </tr> </thead> <tfoot> <tr> <th>Título</th> <th>postabbed</th> </tr> </tfoot> <tbody> <?php $numCheckBox = 0; global $post; $myposts = get_posts( ); foreach( $myposts as $post ) : setup_postdata($post); ?> <tr> <td> <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> </td> <td> <input type="checkbox" name="id" value="<?php the_ID(); ?>" onClick="ct()"> </td> </tr> <?php $numCheckBox++; endforeach; ?> </tbody> </table> <p> <input type="submit" class="button-primary" value="Guardar configuración"> </p> </form>
I need just two things.
first – I need a way of get the values of the checkboxes selected, (remember that the checkboxes have of value the id of the post), with those values i can search those ids in the public view of the widget for show them. But i dont understand the options.php, ho can i save those ids, or other way of get what i need?
Second – if you see in each checkbox there is an onClick event, thats why i tried to get the values with javaScript, but i thing is not the correct way. I need to keep those checkboxes that the user has selected, because i dont want to loose the selection if you recharge the page or send the form, if i saved the checkboxes selected i can save the ids of the posts easier.
Any help ?? =)
- The topic ‘building a plugin (have some question need support)’ is closed to new replies.