Robert

Forum Replies Created

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • in reply to: Parameters when passed as an array doesn’t work #1286101
    Robert
    Participant

    wp_query will do the trick for sure
    But I am not sure if the following parameters will work or not?

    ‘eventDisplay’ => ‘custom’,
    ‘venue’=>$venue,

    in reply to: Parameters when passed as an array doesn’t work #1285331
    Robert
    Participant

    This reply is private.

    in reply to: Parameters when passed as an array doesn’t work #1285329
    Robert
    Participant

    Hey Cliff
    The link you gave me didn’t work

    But I searched a lot and solved this by following code

    $event_start_date = $event_start_date1.’ 00:00′;
    $event_end_date =$event_start_date1.’ 23:59′;
    $meta_query = array(
    ‘relation’=>’AND’,
    ‘start’=> array(
    ‘key’ => ‘_EventStartDate’,
    ‘value’ => $event_start_date,
    ‘compare’ => ‘>=’,
    ),
    ‘end’=>array(
    ‘key’ => ‘_EventStartDate’,
    ‘value’ => $event_end_date,
    ‘compare’ => ‘<=’,
    ),
    );

    if($terms && $tags){
    $tax_query[] = array(
    ‘relation’ => ‘AND’,
    array(
    ‘taxonomy’ => ‘tribe_events_cat’,
    ‘field’ => ‘slug’,
    ‘terms’ => $terms
    ),
    array(
    ‘taxonomy’ => ‘post_tag’,
    ‘field’ => ‘name’,
    ‘terms’ => $tags
    )
    );

    }elseif($tags){
    $tax_query[] = array(
    array(
    ‘taxonomy’ => ‘post_tag’,
    ‘field’ => ‘name’,
    ‘terms’ => $tags
    )
    );
    }elseif($terms){
    $tax_query[] = array(
    array(
    ‘taxonomy’ => ‘tribe_events_cat’,
    ‘field’ => ‘slug’,
    ‘terms’ => $terms
    ) );
    }
    else{
    }

    if($locations){
    $venue=$locations;
    }

    global $post;
    $events = tribe_get_events( array(
    ‘eventDisplay’ => ‘custom’,
    ‘posts_per_page’ => 20,
    ‘tax_query’=>$tax_query,
    ‘venue’=>$venue,
    ‘meta_query’ => $meta_query,
    ‘orderby’=>’_EventStartDate’,
    ‘order’=>’DESC’,
    ));

    in reply to: Parameters when passed as an array doesn’t work #1279435
    Robert
    Participant

    Hey

    thanks for replying..
    May be I figured it out and may be its the right way

    I tried this and

    $tax_query[] =  array(
    			    	array(
    			        'taxonomy' => 'tribe_events_cat',
    			        'field' => 'slug',
    			        'terms' => $terms
    	              ) );
    
    $meta_query = array(
    array(
        'key' => '_EventStartDate',
        'value' => $event_start_date,
        'compare' => '>',			                
    
    ));
    
    global $post;
    $events = tribe_get_events( 
    			array(
    				'eventDisplay' => 'custom',
    				'posts_per_page' => 20,
    				'tax_query'=>$tax_query,
    				'venue'=>$venue,
    				'meta_query' => $meta_query
    			));
    
    foreach ($events as $post):
    	setup_postdata( $post );
    	$post->post_title;
    endforach;
     

    Now I am facing other issue that ‘compare’ => ‘=’ is not working ..

    If I select date 2017-05-01 ,then it doesn’t show me anything ..

    But is I try ‘compare’ => ‘>=’ , then i show me all the events on that date and after that

    But what I want is the events on that particular day only ..

    I hope you can give me a quick solution

    • This reply was modified 9 years ago by Robert.
    in reply to: Parameters when passed as an array doesn’t work #1273781
    Robert
    Participant

    I get the following warning when I try to pass array of event categories
    Warning: urlencode() expects parameter 1 to be string, array given in

    I even noticed that when i try to get all the event categories for each event using following
    $myterms = wp_get_post_terms( $event->ID, TribeEvents::TAXONOMY);

    or

    tribe_get_event_categories($event->ID, array(
    ‘echo’ => false,
    ‘label’ => ”,
    ‘label_before’ => ”,
    ‘label_after’ => ”,
    ‘wrap_before’ => ”,
    ‘wrap_after’ => ”,
    ))

    I still get only one category per event even when most of events have multiple categories

    Looking forward to your response

Viewing 5 posts - 1 through 5 (of 5 total)