add meta box using function.php

function add_meta_boxes() { add_meta_box( ‘repeatable-fields’, ‘Audio Playlist’, ‘repeatable_meta_box_display’, ‘post’, ‘normal’, ‘high’); add_meta_box( ‘wpa-45985’, ‘Wordpress Answers Metabox’, ‘wpa_meta_box_display’, ‘post’, ‘normal’, ‘high’); } add_action(‘admin_menu’, ‘add_meta_boxes’); just define a 2nd metabox, then define its display function and save function. it is exactly the same. EXCEPT, that if you want to save it as a different meta entry then … Read more

Metabox with multiple fields added by user and upload box

Here is how I’ve done it. No changes to the save function are needed. I’ve been trying to save data from both fields at once, thats why it didn’t worked. <input class=”upload_file” type=”text” size=”45″ id=”picture_%1$s” name=”picture_%1$s” value=”%6$s” /> <input class=”upload_button button” type=”button” value=”Upload File” /> <input class=”upload_file_id” type=”hidden” id=”picture_%1$s_id” name=”items[%1$s][picture]” value=”%7$s” /> The value stored … Read more

Get multiple custom field values in a $wpdb query [duplicate]

You are going to have to JOIN twice on the postmeta table. Something like: SELECT $wpdb->posts.ID, $wpdb->posts.post_title, $wpdb->terms.name, wpcflat.meta_value AS latitude, wpcflong.meta_value AS longitude FROM $wpdb->posts /* First Join */ LEFT JOIN $wpdb->postmeta as wpcflong ON $wpdb->posts.ID = wpcflong.post_id /* Second Join */ LEFT JOIN $wpdb->postmeta as wpcflat ON $wpdb->posts.ID = wpcflat.post_id LEFT JOIN $wpdb->term_relationships … Read more

List posts with common custom field value

Retrieving and Listing posts based on current posts metadata Assuming that the custom field is saved as postmeta: global $post; // current post displayed /* grab the value of the custom field for the current post */ $custom_field_value = get_post_meta( $post->ID, ‘custom-field-name’, true ); /* fetch all posts with the same value for the custom … Read more

How to save multiple metaboxes?

You can use one save function. wp_nonce_field function creates hidden field with action. You can use wp_nonce_field for two metaboxes if you want different actions for two metaboxes. Please go throgh below link for more information http://codex.wordpress.org/Function_Reference/wp_nonce_field

Undefined index error when saving content on metabox

Resolved by following comment on Tutsplus Tutorial (link included): In function save_meta(), replace this line: if (!wp_verify_nonce($_POST[‘custom_meta_box_nonce’], basename(__FILE__))) with this line: if (!isset($_POST[‘custom_meta_box_nonce’]) || !wp_verify_nonce($_POST[‘custom_meta_box_nonce’], basename(__FILE__))) See full comment here.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)