Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Garconis/c5af9d885c3b3f3aef38b7604d97b23c to your computer and use it in GitHub Desktop.
Save Garconis/c5af9d885c3b3f3aef38b7604d97b23c to your computer and use it in GitHub Desktop.
WordPress | Function to check for certain The Events Calendar pages and Community template
<?php
// triggers on all Divi pages before the main content
add_action( 'et_before_main_content', 'fs_banner' );
function fs_banner(){
global $post_type;
// tribe_is_community_edit_event_page() Returns true only if the Community Events submission page is currently being viewed (Edit Event, Submit Event/Add New Group)
// tribe_is_community_my_events_page() Returns true only if the Community Events “My Events” page is currently being viewed (My Groups)
// need: Edit Venue/Location, Edit an Organizer
// see list in /the-events-calendar-community-events/src/functions/template-tags.php
// srv/htdocs/wp-content/plugins/the-events-calendar-community-events/src/views/community/default-template.php
global $template;
$template_name = basename( $template );
$template_dir = basename ( dirname( $template ) );
$template_dir_name = $template_dir .'/'. $template_name;
// we want to check if the Tribe (The Events Calendar) community default template is in use, so we set a variable for that initial directory and filename
$tribe_community = 'community/default-template.php';
if( ( $post_type === 'tribe_events' ) || ( tribe_is_community_edit_event_page() ) || ( tribe_is_community_my_events_page() ) || ( $template_dir_name === $tribe_community ) ){
// output and render the shortcode
echo do_shortcode('[et_pb_section global_module="1002"][/et_pb_section]');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment