WordPress.org

Making WordPress.org

Changeset 6013


Ignore:
Timestamp:
10/09/2017 11:21:08 PM (21 months ago)
Author:
coreymckrill
Message:

WordCamp Sessions: Enable shortcode to output by session date/time

  • Adds a new session_time value for the orderby shortcode parameter so that the sessions are ordered by the date and time that they will occur. This is different than the date value, which orders by the date and time that the session post was published.
  • Updates the content of the Sessions page stub used to populate new WordCamp sites so that the shortcode begins with the session_time value and orders ascending instead of descending. This was done instead of changing the default values of the shortcode parameters so that existing WordCamp sites using the shortcode won't be affected.

Fixes #1896
Props SergeyBiryukov, coreymckrill

Location:
sites/trunk/wordcamp.org/public_html/wp-content/plugins
Files:
2 edited

Legend:

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

    r5854 r6013  
    915915            'speaker_link'   => 'wporg', // anchor|wporg|permalink|none
    916916            'posts_per_page' => -1,
    917             'orderby'        => 'date', // date|title|rand
     917            'orderby'        => 'date', // date|title|rand|session_time
    918918            'order'          => 'desc', // asc|desc
    919919        ), $attr );
     
    934934            $attr['speaker_link'] = 'anchor';   // todo this is inconsistent with the values passed to shortcode_atts, and probably not needed if the default above is changed to 'anchor'
    935935
    936         $attr['orderby'] = ( in_array( $attr['orderby'], array( 'date', 'title', 'rand' ) ) ) ? $attr['orderby'] : 'date';
     936        $attr['orderby'] = ( in_array( $attr['orderby'], array( 'date', 'title', 'rand', 'session_time' ) ) ) ? $attr['orderby'] : 'date';
    937937
    938938        if ( 'asc' != $attr['order'] ) {
     
    988988                'terms'    => $attr['track'],
    989989            );
     990        }
     991
     992        // Order by session date/time.
     993        if ( 'session_time' === $args['orderby'] ) {
     994            $args['meta_key'] = '_wcpt_session_time';
     995            $args['orderby']  = 'meta_value_num title';
    990996        }
    991997
  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/wcpt/wcpt-wordcamp/wordcamp-new-site.php

    r5510 r6013  
    506506                'content' =>
    507507                    '<p>' . __( '<em>Organizers note:</em> You can enter content for this page in the Sessions menu item in the sidebar.', 'wordcamporg' ) . '</p> ' .
    508                     '<p>[sessions]</p>',
     508                    '<p>[sessions orderby="session_time" order="asc"]</p>',
    509509                'status'  => 'publish',
    510510                'type'    => 'page',
Note: See TracChangeset for help on using the changeset viewer.