Skip to content

Instantly share code, notes, and snippets.

@lelandf
Last active September 27, 2021 20:35
Show Gist options
  • Save lelandf/4f9ea42019586539610c8cfeaf7a0b22 to your computer and use it in GitHub Desktop.
Save lelandf/4f9ea42019586539610c8cfeaf7a0b22 to your computer and use it in GitHub Desktop.
[TEC] Remove date from calendar day view (WP conditional sample)
<?php
add_action( 'wp_footer', function() {
// Replace with your own Page ID.
// Reference: https://developer.wordpress.org/reference/functions/is_page/
if ( is_page( 2 ) ) :
?>
<script>
(function () {
const dates = document.querySelectorAll( '.tribe-events-calendar-day__event-datetime .tribe-event-date-start' );
if ( ! dates ) {
return;
}
function splitter( date ) {
const array = date.textContent.split( '@ ' );
date.textContent = array[1];
}
dates.forEach( splitter );
})();
</script>
<?php
endif;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment