Last active
          August 20, 2025 09:00 
        
      - 
      
 - 
        
Save chugs/02c247ec706aaae2d22c03fee260dd73 to your computer and use it in GitHub Desktop.  
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | <?php | |
| /* ------------------------------------------------------------------------------- | |
| // Display the custom taxonomy term title above events list on initial load. | |
| ------------------------------------------------------------------------------- */ | |
| add_action('wp_enqueue_scripts', function () { | |
| if (! function_exists('tribe_is_event_query') || ! tribe_is_event_query()) { | |
| return; | |
| } | |
| $festival_name = ''; | |
| if (isset($_GET['tribe_filterbar_eventfestival'][0])) { | |
| $term_id = intval($_GET['tribe_filterbar_eventfestival'][0]); | |
| $term = get_term($term_id, 'event_festival'); | |
| if ($term && ! is_wp_error($term)) { | |
| $festival_name = $term->name; | |
| } | |
| } | |
| wp_enqueue_script( | |
| 'pf-event-festival-title', | |
| get_stylesheet_directory_uri() . '/assets/js/custom/event-festival-title.js', | |
| ['jquery'], | |
| '1.0', | |
| true | |
| ); | |
| wp_localize_script('pf-event-festival-title', 'pfFestivalData', [ | |
| 'festivalName' => $festival_name, | |
| 'taxonomyParam' => 'tribe_filterbar_eventfestival', | |
| ]); | |
| }); | |
| /**/ | |
| /* ------------------------------------------------------------------------------- | |
| * Include active festival title in TEC AJAX response so JS can update header after AJAX loads | |
| ------------------------------------------------------------------------------- */ | |
| add_filter('tribe_events_ajax_response', function ($response) { | |
| $response['pfFestivalTitle'] = ''; | |
| if (isset($_REQUEST['tribe_filterbar_eventfestival'][0])) { | |
| $term_id = intval($_REQUEST['tribe_filterbar_eventfestival'][0]); | |
| $term = get_term($term_id, 'event_festival'); | |
| if ($term && ! is_wp_error($term)) { | |
| $response['pfFestivalTitle'] = $term->name; | |
| } | |
| } | |
| return $response; | |
| }, 10); | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment