Inefficient Query Confusion

…or try this: // … put your $today and $future variables here… global $wpdb; $events = $wpdb->get_results( ” SELECT * FROM {$wpdb->posts} LEFT JOIN( SELECT DISTINCT post_id, (SELECT CAST(meta_value AS DATE) FROM {$wpdb->postmeta} WHERE {$wpdb->postmeta}.post_id = meta.post_id AND meta_key =’opening_time’) AS opening_time, (SELECT CAST(meta_value AS DATE) FROM {$wpdb->postmeta} WHERE {$wpdb->postmeta}.post_id = meta.post_id AND meta_key =’artist_talk_time’) … Read more

Adding URL of PDF from Thickbox in a Meta Box

This line… imgurl = jQuery(‘img’,html).attr(‘src’); Means that jQuery is getting the “source” (i.e. full path) of the image. As you’ve guessed, that won’t work for a PDF file. What you’ll probably have to do is get the id of the attachment instead. Could you possibly update your original answer with the HTML SOURCE of the … Read more

Meta box on options page save form problem

It’s not enough to define areas and put metaboxes in them, you must define the layout via the current screen. For example, when displaying a dashboard esque widget area on my custom option page, the first things I have are: global $screen_layout_columns; add_screen_option(‘layout_columns’, array(‘max’ => 3, ‘default’ => 3) ); $screen = get_current_screen(); wp_enqueue_script( ‘dashboard’ … Read more

Use a shortcode to display custom meta box contents

yeah, the question is a bit unclear. but i think you need shortcode attributes function get_custom_field_fn( $atts) { global $post; extract( shortcode_atts( array( ‘meta’ => ” ), $atts ) ); $custom_field_value = get_post_meta($post->ID, $meta, true); return $custom_field_value; } add_shortcode(‘cf_name’, ‘get_custom_field_fn’); see the codex: http://codex.wordpress.org/Shortcode_API#Attributes

Forms and WordPress Nonce

The logic here is incorrect: // Verify this came from the our screen and with proper authorization, because save_post can be triggered at other times if ( !isset( $_POST[‘mrlpt_client_check’] ) && !wp_verify_nonce( $_POST[‘mrlpt_client_check’], ‘mrlpt_submit_client’ ) ) { return; } This reads if the $_POST[‘mrlpt_client_check’] is not set and is invalid – return. You want it … Read more