Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter eccles42

    (@eccles42)

    Here’s my workaround in case its of any use to anyone. This function returns url and title of events that occur on a specific day, I use it in a calendar.

    You’ll just need to adjust the “-3 days” to suit the length of events since tribe_get_events wont return events already in progress. It needs a bit more refinement, like an end date so it doesn’t keep returning a whole year, but hopefully it’ll help someone.

    function get_event_link($day,$month,$year)
    {
    	global $post;
    		
    	$searchDate = mktime(00, 00, 00, $month, $day, $year);
            
    	// Retrieve events from the search date -3 days
    	$events = tribe_get_events(  [
        	'eventDisplay' => 'custom',
        	'start_date'   => strtotime('-3 days',$searchDate)
    	] );
    	
    	//loop through the events until an event between the start end end date is found
    	foreach ( $events as $post ) {
        	setup_postdata( $post ); 
                $startDate = strtotime(tribe_get_start_date($post->ID, false, 'Y-m-d'));
                $endDate = strtotime(tribe_get_end_date($post->ID, false, 'Y-m-d'));
        
                if($searchDate>=$startDate && $searchDate<=$endDate)                    
    		return array(tribe_get_event_link($post),$post->post_title);
    	}
    }

    Andy

    Thread Starter eccles42

    (@eccles42)

    Thanks for the reply. The thing is that it used to work and worked for quite a while. I’d seen that page and my understanding of it was that start_date and end_date indicated the date range to search within, as described here – https://support.theeventscalendar.com/666307-Using-tribe_get_events/666307-Using-tribe_get_events?r=1#event-specific-arguments

    If start_date was the start of the events then the first example would only return events starting on the day passed to the function, not the next 5 events.

    Amway I just wondered if anyone had encountered something similar as I can always code around it.

    Thanks,

    Andy

    Thanks, Sayful. And Thanks for this plugin, I couldn’t find one that did quite what I had in mind until I found yours.

    Andy

    I’m getting the same thing, and having a dig around, the problem seems to be in carousel-slider\templates\public\hero-banner-slider.php on the line…

    $_link_target = ! empty( $slide['link_target'] ) && in_array( $slide['link_target'],
     array( '_self', '_blank' ) ) ? esc_url( $slide['link_target'] ) : '_self';

    The function “esc_url” should be “esc_attr”, as its an attribute that being sanitised. The result is that the target is ending up as “https://_self&#8221;, presumably the browser defaults to opening in a new tab as it’s invalid.

    • This reply was modified 7 years, 2 months ago by eccles42.
    • This reply was modified 7 years, 2 months ago by eccles42.
    • This reply was modified 7 years, 2 months ago by eccles42. Reason: typos!
Viewing 4 replies - 1 through 4 (of 4 total)