Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

Untitled

a guest Oct 12th, 2018 66 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. <?php
  2. // IN FUNCTIONS.PHP
  3. function set_event_transients() {
  4.  
  5.     $upcoming_events = tribe_get_events( array(
  6.         'eventDisplay' => 'upcoming',
  7.         'posts_per_page' => -1
  8.     ));
  9.  
  10.     if ( true === ( get_transient( 'upcoming_events' ) ) )
  11.         delete_transient( 'upcoming_events' );
  12.                    
  13.     set_transient( 'upcoming_events', $upcoming_events );
  14. }
  15. add_action('admin_init','set_event_transients');
  16.  
  17. $upcoming_events = get_transient('upcoming_events');
  18. ?>
  19.  
  20. <?php
  21. // IN SINGLE-ARTISTS.PHP (THEME TEMPLATE FILE)
  22. global $upcoming_events;
  23.  
  24. $artist_events = $upcoming_events;
  25.        
  26. $has_post = 0;
  27.  
  28. if (!empty($artist_events)):
  29.     global $post;
  30.  
  31.     foreach ($artist_events as $post):
  32.         setup_postdata($post);
  33.        
  34. // etc. etc.
  35. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top