Function Reference: geodir_sc_event_listing
Summary
This function has not been documented yet.
Source File
geodir_sc_event_listing() is located in geodir_event_manager/gdevents_shortcodes.php [Line: 8]
Source Code
function geodir_sc_event_listing( $atts ) {
ob_start();
$defaults = array(
'post_type' => 'gd_event',
'category' => '0',
'post_number' => 5,
'layout' => 'gridview_onehalf',
'add_location_filter' => 1,
'listing_width' => '',
'list_sort' => 'latest',
'list_filter' => 'all',
'character_count' => 20,
'title' => '',
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
'after_title' => '
'
);
$params = shortcode_atts( $defaults, $atts );
/**
* Begin validating the params
*/
// Validate the category/ies chosen
$params['category'] = gdsc_manage_category_choice( $params['post_type'], $params['category'] );
// Post_number needs to be a positive integer
$params['post_number'] = absint( $params['post_number'] );
if ( 0 == $params['post_number'] ) {
$params['post_number'] = 1;
}
// Validate our layout choice
// Outside of the norm, I added some more simple terms to match the existing
// So now I just run the switch to set it properly.
$params['layout'] = gdsc_validate_layout_choice( $params['layout'] );
// Validate Listing width, used in the template widget-listing-listview.php
// The context is in width=$listing_width% - So we need a positive number between 0 & 100
$params['listing_width'] = gdsc_validate_listing_width( $params['listing_width'] );
// Validate our sorting choice
$params['list_sort'] = $params['list_sort'] == 'upcoming' ? $params['list_sort'] : gdsc_validate_sort_choice( $params['list_sort'] );
// Validate our sorting choice
$params['list_filter'] = gdsc_validate_list_filter_choice( $params['list_filter'] );
// Validate character_count
$params['character_count'] = absint( $params['character_count'] );
if ( 20 > $params['character_count'] ) {
$params['character_count'] = 20;
}
$params['title'] = sanitize_text_field( $params['title'] );
if ( empty( $params['title'] ) || $params['title'] == 'All' ) {
$params['title'] .= ' ' . get_post_type_plural_label( $params['post_type'] );
}
geodir_event_postview_output($params, $params);
$output = ob_get_contents();
ob_end_clean();
return $output;
}