-
-
Save Pebblo/25705b6b4fd3ad3f706330304fca62fb to your computer and use it in GitHub Desktop.
Example of how to change the archive title to remove 'Archive: ' and dynamically display the events slug set in settings
This file contains 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 //Please do not include the opening PHP tag if you alreayd have one. | |
function tw_ee_get_the_archive_title($title) { | |
if(is_post_type_archive('espresso_events')) { | |
if(class_exists('EE_Registry')){ | |
$event_slug = EE_Registry::instance()->CFG->core->event_cpt_slug; | |
return ucfirst($event_slug); | |
} | |
} | |
return $title; | |
} | |
add_filter( 'get_the_archive_title', 'tw_ee_get_the_archive_title', 20, 1 ); |
This file contains 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 //Please do not include the opening PHP tag if you alreayd have one. | |
function tw_ee_get_the_archive_title_hardcoded($title) { | |
if(is_post_type_archive('espresso_events')) { | |
return 'Current Events'; | |
} | |
return $title; | |
} | |
add_filter( 'get_the_archive_title', 'tw_ee_get_the_archive_title_hardcoded', 20, 1 ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment