Making WordPress.org


Ignore:
Timestamp:
02/27/2015 01:28:12 AM (12 years ago)
Author:
iandunn
Message:

WordCamp Post Type: Add optional date parameter to [sessions].

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/wc-post-types/wc-post-types.php

    r1333 r1340  
    861861
    862862                $attr = shortcode_atts( array(
     863                        'date' => null,
    863864                        'show_meta' => false,
    864865                        'show_avatars' => false,
     
    898899                        // not exist, for backwards compatibility.
    899900                        'meta_query' => array(
    900                                 'relation' => 'OR',
     901                                'relation' => 'AND',
     902
    901903                                array(
    902                                         'key' => '_wcpt_session_type',
    903                                         'value' => 'session',
    904                                         'compare' => '=',
    905                                 ),
    906                                 array(
    907                                         'key' => '_wcpt_session_type',
    908                                         'value' => '',
    909                                         'compare' => 'NOT EXISTS',
    910                                 ),
     904                                        'relation' => 'OR',
     905
     906                                        array(
     907                                                'key'     => '_wcpt_session_type',
     908                                                'value'   => 'session',
     909                                                'compare' => '=',
     910                                        ),
     911
     912                                        array(
     913                                                'key'     => '_wcpt_session_type',
     914                                                'value'   => '',
     915                                                'compare' => 'NOT EXISTS',
     916                                        ),
     917                                )
    911918                        ),
    912919                );
     920
     921                if ( $attr['date'] && strtotime( $attr['date'] ) ) {
     922                        $args['meta_query'][] = array(
     923                                'key'     => '_wcpt_session_time',
     924                                'value'   => array(
     925                                        strtotime( $attr['date'] ),
     926                                        strtotime( $attr['date'] . ' +1 day' ),
     927                                ),
     928                                'compare' => 'BETWEEN',
     929                                'type'    => 'NUMERIC',
     930                        );
     931                }
    913932
    914933                if ( 'all' != $attr['track'] ) {
Note: See TracChangeset for help on using the changeset viewer.