Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if( get_option('dbem_events_page_search') && !defined('DOING_AJAX') ){
- em_locate_template('templates/events-search.php',true);
- }
- //TODO fine tune ajax searches - we have some pagination issues otherwise, due to search querystrings
- if( get_option('dbem_events_page_ajax', (defined('EM_AJAX_SEARCH'))) ) echo "<div class='em-events-search-ajax'>";
- $events_count = EM_Events::count( apply_filters('em_content_events_args', $args) );
- $args['category'] = '6,7,8,10,11,12,13,14';
- $args['limit'] = get_option('dbem_events_default_limit');
- $args['page'] = (!empty($_REQUEST['page']) && is_numeric($_REQUEST['page']) )? $_REQUEST['page'] : 1;
- if( $events_count > 0 ){
- //If there's a search, let's change the pagination a little here
- if(!empty($_REQUEST['action']) && $_REQUEST['action'] == 'search_events'){
- $args['pagination'] = false;
- echo EM_Events::output( $args );
- //do some custom pagination (if needed/requested)
- if( !empty($args['limit']) && $events_count > $args['limit'] ){
- //Show the pagination links (unless there's less than $limit events), note that we set em_search instead of search to prevent conflicts
- $search_args = array_merge(EM_Events::get_post_search(), array('page'=>'%PAGE%','action'=>'search_events','search'=>null, 'em_search'=>$args['search']));
- $page_link_template = em_add_get_params($_SERVER['REQUEST_URI'], $search_args, false); //don't html encode, so em_paginate does its thing
- echo apply_filters('em_events_output_pagination', em_paginate( $page_link_template, $events_count, $args['limit'], $args['page']), $page_link_template, $events_count, $args['limit'], $args['page']);
- }
- }else{
- echo EM_Events::output( $args );
- }
- }else{
- echo get_option ( 'dbem_no_events_message' );
- }
- if( get_option('dbem_events_page_ajax', (defined('EM_AJAX_SEARCH'))) ) echo "</div>";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement