Hot answers tagged

2

Wordpress comes preloaded with the scripts to do datepickers. If you dont want to do it with a plugin, create a regular text metabox, then you need to enqueue a custom script in the wordpress admin with jquery-ui and jquery-ui-datepicker dependencies: function enqueue_date_picker(){ wp_enqueue_script( 'field-date', ...


2

I will suggest to check the $post object in PHP before adding meta box. And add the meta box if status is draft or auto-draft. Consider this code function update_meta_boxes($current_post_type, $post) { $post_types = apply_filters('lsw_default_post_types', LSW_Organize_Drafts::$post_types); remove_meta_box( 'tagsdiv-lswdrafttype', $post_types, ...


1

You need to loop through your posts, and retrieve the metadata for each post. Add them to your array, and encode them to JSON. $posts = $query->get_posts(); foreach( $posts as &$thispost ) { // reference the current item $thispost->meta = get_post_meta( $thispost->ID ); } Now you got a WP_Post-Object, with all the post meta available at ...



Only top voted, non community-wiki answers of a minimum length are eligible