Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- switch( $_GET['orderby'] ) {
- case 'eval_workshop_date':
- $mq = array(
- 'relation' => 'OR',
- 'individual' => array(
- 'key' => 'workshop_or_individual_clients',
- 'value' => 'A workshop',
- 'compare' => '!='
- ),
- 'workshop_date' => array(
- 'key' => 'workshop_completion_date',
- 'value' => '',
- 'compare' => '!='
- ),
- );
- // Add existing meta query back in if it exists
- if ( $query->get( 'meta_query' ) ) {
- $mq = array(
- 'relation' => 'AND',
- $mq,
- $query->get( 'meta_query' )
- );
- }
- // Set the meta query
- $query->set( 'meta_query', $mq );
- // Change it to order by our new meta query options
- $query->set( 'orderby', array(
- 'individual' => 'DESC',
- 'workshop_date' => 'DESC'
- ));
- break;
- }
- SELECT DISTINCT SQL_CALC_FOUND_ROWS wp_posts.*
- FROM wp_posts
- INNER JOIN wp_postmeta
- ON ( wp_posts.ID = wp_postmeta.post_id )
- INNER JOIN wp_postmeta AS mt1
- ON ( wp_posts.ID = mt1.post_id )
- INNER JOIN wp_postmeta AS a
- ON ( a.post_id = wp_posts.ID )
- INNER JOIN wp_postmeta AS b
- ON ( ( b.meta_id = a.meta_id + @@auto_increment_increment )
- AND ( b.post_id = wp_posts.ID ) )
- INNER JOIN wp_posts AS c
- ON ( ( c.post_type = 'acf-field' )
- AND ( ( c.post_content LIKE '%:"text"%' )
- OR ( c.post_content LIKE '%:"textarea"%' )
- OR ( c.post_content LIKE '%:"wysiwyg"%' ) ) )
- WHERE 1 = 1
- AND ( ( ( c.post_name = b.meta_value )
- AND ( a.meta_value LIKE '%Workshop%' )
- AND ( a.meta_value LIKE '%5%' ) )
- OR ( ( ( wp_posts.post_title LIKE '%Workshop%' )
- OR ( wp_posts.post_content LIKE '%Workshop%' )
- OR ( wp_posts.post_excerpt LIKE '%Workshop%' ) )
- AND ( ( wp_posts.post_title LIKE '%5%' )
- OR ( wp_posts.post_content LIKE '%5%' )
- OR ( wp_posts.post_excerpt LIKE '%5%' ) ) ) )
- AND ( ( wp_postmeta.meta_key = 'workshop_or_individual_clients'
- AND wp_postmeta.meta_value != 'A workshop' )
- OR ( mt1.meta_key = 'workshop_completion_date'
- AND mt1.meta_value != '' ) )
- AND wp_posts.post_type = 'dtl-evaluation'
- AND ( wp_posts.post_status = 'publish'
- OR wp_posts.post_status = 'acf-disabled'
- OR wp_posts.post_status = 'future'
- OR wp_posts.post_status = 'draft'
- OR wp_posts.post_status = 'pending'
- OR wp_posts.post_status = 'private' )
- GROUP BY wp_posts.ID
- ORDER BY CAST(wp_postmeta.meta_value AS CHAR) DESC,
- CAST(mt1.meta_value AS CHAR) DESC,
- wp_posts.post_date DESC
- LIMIT 0, 20
- +-----------------------+------------------------------------+---------+
- | Column | Type | Comment |
- +-----------------------+------------------------------------+---------+
- | ID | bigint(20) unsigned Auto Increment | |
- | post_author | bigint(20) unsigned [0] | |
- | post_date | datetime [0000-00-00 00:00:00] | |
- | post_date_gmt | datetime [0000-00-00 00:00:00] | |
- | post_content | longtext | |
- | post_title | text | |
- | post_excerpt | text | |
- | post_status | varchar(20) [publish] | |
- | comment_status | varchar(20) [open] | |
- | ping_status | varchar(20) [open] | |
- | post_password | varchar(255) [] | |
- | post_name | varchar(200) [] | |
- | to_ping | text | |
- | pinged | text | |
- | post_modified | datetime [0000-00-00 00:00:00] | |
- | post_modified_gmt | datetime [0000-00-00 00:00:00] | |
- | post_content_filtered | longtext | |
- | post_parent | bigint(20) unsigned [0] | |
- | guid | varchar(255) [] | |
- | menu_order | int(11) [0] | |
- | post_type | varchar(20) [post] | |
- | post_mime_type | varchar(100) [] | |
- | comment_count | bigint(20) [0] | |
- +-----------------------+------------------------------------+---------+
- Keys:
- +---------+---------------------------------------+
- | PRIMARY | ID |
- +---------+---------------------------------------+
- | INDEX | post_name(191) |
- | INDEX | post_type, post_status, post_date, ID |
- | INDEX | post_parent |
- | INDEX | post_author |
- +---------+---------------------------------------+
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement