Classes Shortcodes

Classes comes with a couple of helpful shortcodes to make marketing your classes easier.

Class Dates

You can use the [itecls_dates] shortcode to display a list of all the dates and times your class meets.

Usage

To control which class' dates should be shown, use the class attribute. For example, [itecls_dates class=15], would display the dates list for the class with an ID of 15. If you're using this shortcode on your product page, you don't need to specify the class ID.

Filters

By default, the days are formatted using the date format and time format you specify in WordPress' settings. This can be changed with a filter like so:

add_filter( 'itecls_class_dates_shortcode_date_format', 
function( $format, \ITECLS\OClass $class ) {

    if ( $class->get_ID() === 15 ) {
        $format = 'Y-m-d H:i';
    }

    return $format;
}, 10, 2 );

That will make the dates for the class with an ID of 15 formatted to be 2015-02-18 3:45. You can view the different formatting options in the PHP Manual.

Class Attendees

You can use the [itecls_attendees] shortcode to display a list of all of the names of a class's attendees.

Usage

To control which class' attendees should be shown, use the class attribute. For example, [itecls_attendees class=15], would display the attendees list for the class with an ID of 15. If you're using this shortcode on your product page, you don't need to specify the class ID.

Filters

By default, each attendee will have their first and last name displayed. You can change what information is displayed using a filter.

add_filter( 'itecls_class_attendees_student_name',
function( $name, \ITECLS\Student $student ) {
    return get_avatar( $student->ID ) . ' ' . $student->first_name;
}, 10, 2 );

That will display the first name of each student and their gravatar.

Have more questions? Submit a request

Comments

Powered by Zendesk