New shortcode [events_grid]
-
Would be great if you could add the shortcode
[events_grid]
in a future release!In the meantime I took the
[events_list]
code and quickly adapted it:add_shortcode('events_grid', 'em_get_events_grid_shortcode'); function em_get_events_grid_shortcode($args, $format='') { $args = (array) $args; $args['ajax'] = isset($args['ajax']) ? $args['ajax']:(!defined('EM_AJAX') || EM_AJAX ); $args['format'] = ($format != '' || empty($args['format'])) ? $format : $args['format']; $args['format'] = html_entity_decode($args['format']); //shortcode doesn't accept html $args['limit'] = isset($args['limit']) ? $args['limit'] : get_option('dbem_events_default_limit'); if( !empty($args['id']) ) $args['id'] = rand(); if( empty($args['format']) && empty($args['format_header']) && empty($args['format_footer']) ){ ob_start(); em_locate_template('templates/events-grid.php', true, array('args'=>$args)); $return = ob_get_clean(); }else{ $args['ajax'] = false; $pno = ( !empty($args['pagination']) && !empty($_GET['pno']) && is_numeric($_GET['pno']) )? $_GET['pno'] : 1; $args['page'] = ( !empty($args['pagination']) && !empty($args['page']) && is_numeric($args['page']) )? $args['page'] : $pno; $return = EM_Events::output( $args ); } return $return; }
I didn’t check all the code logic, so probably something is missing or redundant, but for what I needed it seems working. ??
I hope it helps others!
Viewing 9 replies - 1 through 9 (of 9 total)
Viewing 9 replies - 1 through 9 (of 9 total)
- The topic ‘New shortcode [events_grid]’ is closed to new replies.