Last active
September 27, 2021 20:35
-
-
Save lelandf/4f9ea42019586539610c8cfeaf7a0b22 to your computer and use it in GitHub Desktop.
[TEC] Remove date from calendar day view (WP conditional sample)
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 | |
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