top of page

EventBrite Events on WP

  • Writer: سُلَيْمَان بْن دَاوُوْد
    سُلَيْمَان بْن دَاوُوْد
  • Jul 9, 2021
  • 1 min read


function event_brite_live_event(){

    date_default_timezone_set('Pacific/Honolulu');
    $ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "https://www.eventbriteapi.com/v3/organizations/222261592032/events/?expand=organizer&status=live");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, FALSE);

curl_setopt($ch, CURLOPT_HTTPHEADER, array(
  "Authorization: Bearer UX7CQYUKMUWDCTFJ6GEX"
));

$response = curl_exec($ch);
curl_close($ch);
$data = json_decode($response);

    $events = $data->events;

    $evt = '';
    foreach ($events as $event) {

    $event_img = '';
    if($event->logo->original->url){
        $event_img =  $event->logo->original->url; 
    }else{
        $event_img = 'https://www.koka.org/wp-content/uploads/2019/12/47a942.png';
    }
    if($event->listed!=''){ /*hide private event*/
        $evt .= '<div class="column">
                <figure>
                   <a target="_blank" href="'.$event->url.'"><img src="'.esc_url($event_img).'" /></a>
                </figure>
                <div class="column-content">
                    <div class="date">
                        <h5>'.date('M',strtotime($event->start->utc)).' <span>'.date('d',strtotime($event->start->utc)).'</span></h5>
                    </div>
                    <div class="content">
                         <a target="_blank" href="'.$event->url.'"><h4>'.$event->name->text.'</h4></a>
                        <p class="black">'.$event->organizer->name.'</p>
                    </div>
                </div>
            </div>';
        }
    }

    return $evt;
}

add_shortcode('event_brite_live_event','event_brite_live_event');


 
 
 

Recent Posts

See All
Duplicate Category in Wordpress

The following code helps to duplicate the default wordpress category by help of code. // Add Duplicate option for categories in WordPress...

 
 
 
C#.NET and Its Associated Codes

1- Creating an Desktop Application in C#.NET C# ADO.NET & MySQL MAIN C# and MySQL ADO.NET with Crystals Reports Ready Code 2- Handling...

 
 
 

Comments


© 2020 by syednazrulhassan

bottom of page