How to put Periods and Spaces for Array Values (Meta Key)

You may have build your meta box wrong: If your custom field names are not valid variable names PHP will convert all characters not matching [a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff] to underscores. The reason: register_globals. A request field must be able to work as a variable. There are two workarounds: Name the field like an array: <input name=”foo[TrackNumber mp3.Artist]”>. … Read more

Timepicker-addon doesn’t show – Datepicker works fine?

Figured out that I needed to have the right js dependencies declared. This code now works. Hope it helps someone else with the same problem. Key line array(‘jquery-ui-core’ ,’jquery-ui-datepicker’, ‘jquery-ui-slider’) Full `wp-enqueue’ code: function pbd_events_jquery_datepicker() { wp_enqueue_script( ‘jquery-ui-datepicker’, get_bloginfo(‘template_directory’) . ‘/jquery-ui-datepicker/jquery-ui-1.8.16.custom.min.js’, array(‘jquery’) ); wp_enqueue_script( ‘jquery-ui-timepicker-addon’, get_bloginfo(‘template_directory’) . ‘/jquery-ui-datepicker/jquery-ui-timepicker-addon.js’, array(‘jquery-ui-core’ ,’jquery-ui-datepicker’, ‘jquery-ui-slider’) ); wp_enqueue_script( ‘pbd-datepicker’, get_bloginfo(‘template_directory’) … Read more

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

Include captions

st Note: // Prepare the code for safety $images = $wpdb->get_col( $wpdb->prepare( ” SELECT ID FROM %s WHERE post_type=”attachment” AND ID IN ( %s ) ORDER BY menu_order ASC “, $wpdb->posts, $meta ) ); nd Note: Look into what you already got: // Inside the foreach loop echo ‘<pre>’; var_dump( $att ); echo ‘<pre>’; rd … 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 Order of Meta Box in a Page/Post

It’s not that hard: There’s a user Meta entry for that. You can not only retrieve the order, but also which ones are hidden (just to get one step further). # Meta Box Order $meta_box_order = get_user_meta( wp_get_current_user()->ID ,sprintf( ‘meta-box-order_%s’, get_post_type() ) ,true ); # Hidden Meta Box $meta_box_hidden = get_user_meta( wp_get_current_user()->ID ,sprintf( ‘metaboxhidden_%s’, get_post_type() … Read more

Image display from custom field

If you use update_post_meta() than also use get_post_meta() (see Codex) and not get_post_custom $order = get_post_meta( $post->ID, ‘order’, true ); $image = get_post_meta( $post->ID, ‘image’, true ); And than check in your HTML source what your image tag looks like. I bet it will look like this: <img src=”https://wordpress.stackexchange.com/questions/75550/coffee_star.jpg” /> What about the path to … 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

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