Skip to main content
8 events
when toggle format what by license comment
Jun 11, 2012 at 14:51 comment added Rob Myrick icc97, I re-inserted some other example code from another tutorial and it appears that my problem is in saving the dropdown item, not the dropdown code itself. Once I clean up the saving part of it, I should be able to use the original functions we discussed. Thanks for your help...
Jun 10, 2012 at 22:30 comment added Rob Myrick foreach ($events_meta as $key => $value) { if( $post->post_type == 'revision' ) return; $value = implode(',', (array)$value); if(get_post_meta($post->ID, $key, FALSE)) { update_post_meta($post->ID, $key, $value); } else { add_post_meta($post->ID, $key, $value); } if(!$value) delete_post_meta($post->ID, $key); } } add_action('save_post', 'wpt_save_events_meta', 1, 2);
Jun 10, 2012 at 22:27 comment added Rob Myrick $events_meta['page_template'] = $_POST['page_template'];
Jun 10, 2012 at 21:35 comment added Rob Myrick Also, in the database, the DB updates based on "page_template" label, not the $template variable. But the drop-down does, in fact, change based on the $template variable. I could post my full functions file for you - since I'm testing it only has this custom post type functionality within it, so not messy
Jun 10, 2012 at 21:02 comment added icc97 If as you say your default template gets updated in the database correctly - then when you refresh the page then you should have the text of the selected template in the $template variable. Have you tried printing out the $template variable to see what's in it?
Jun 10, 2012 at 16:56 comment added Rob Myrick I added the newest update to my functions.php for you to see. Again, I'm getting the dropdown to display properly and even post to the table, but it's not holding its value when saved by the user.
Jun 10, 2012 at 16:44 comment added Rob Myrick Yeah I've been studying both of those pieces of code. I don't really understand how they work together. I've added the function to my functions.php file, and nothing changed. Also, for saving the selection, am I supposed to use page_template or default as my label later on when I use this code to save the data: $events_meta['page_template'] = $_POST['page_template'];
Jun 10, 2012 at 10:36 history answered icc97 CC BY-SA 3.0