Modifying a function
-
I have:
/* * Routine to display a custom meta box editor * Note: In this example our custom meta data is saved as a row in the postmeta database table. * $post PostObject An object representing a WordPress post that is currently being loaded in the post editor. */ function camere_meta_box_render( $post ){ // Get the number and display it in a numeric field $number = get_post_meta( $post->ID, "function_camere", true ); echo '<div><select name="function_camere">'; for( $i = 0; $i < 13; $i++ ) { echo '<option value="'.$i.'" '. selected( $number, $i, false ) .' >'.$i.'</option>'; } echo '</select></div>'; } // Hook into the save routine for posts add_action( 'save_post', 'camere_meta_box_save'); /* * Routine to save the custom post meta data from the editor * Note: We retrieve the form data through the PHP Global $_POST * $post_id int The ID of the post being saved */ function camere_meta_box_save( $post_id ){ // Check to see if this is our custom post type (remove this check if applying the meta box globally) if($_POST['post_type'] == "post"){ // Retrieve the values from the form $number = $_POST['function_camere']; // Clean, sanitize and validate the input as appropriate // Save the updated data into the custom post meta database table update_post_meta( $post_id, "function_camere", $number );
I dont need numbers now, but the options are gettexted sentences, how can I echo these sentences from a selector?
The page I need help with: [log in to see the link]
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
- The topic ‘Modifying a function’ is closed to new replies.