Support

Home Forums Event Espresso Premium Change Archive Event Page Title

Change Archive Event Page Title

Posted: May 31, 2016 at 12:28 pm


info@hrgirlfriends.com

May 31, 2016 at 12:28 pm

I have set up the event archive page as “Events”, but it says “Archives: Events”. I have checked with the theme maker (accesspress themes: mag pro theme) and they say it’s not being applied from their end.

Please help!


Josh

  • Support Staff

May 31, 2016 at 1:52 pm

Can you open up the theme’s archive.php template, and check for some code that prints “Archives: {Custom Post type}”?


info@hrgirlfriends.com

May 31, 2016 at 2:55 pm

It didn’t have that specifically, but there was this:


<header class="page-header">
				<?php apmag_the_archive_title( '<h1 class="page-title"><span>', '</span></h1>' ); ?>
			</header><!-- .page-header -->


Josh

  • Support Staff

May 31, 2016 at 3:23 pm

Yep, so the theme is indeed adding the “Archives: ” bit.

Does this theme have a /inc/template-tags.php file, where around line 220 it has this:

} elseif ( is_post_type_archive() ) {
  $title = sprintf( __( 'Archives: %s', 'accesspress-mag' ), post_type_archive_title( '', false ) );
}

You could change the actual function there, but if there’s a filter hook somewhere in the function, that’d probably be a better approach. Can you post the contents of the theme’s /inc/template-tags.php file to a gist or paste bin, then link here?


info@hrgirlfriends.com

May 31, 2016 at 4:20 pm

Yup! It sure does…I will be sure to cross post this back to them, because they didn’t even know it was there.
Here’s that paste: http://pastebin.com/baUNLWSs


Josh

  • Support Staff

June 1, 2016 at 8:53 am

Thanks for posting. There is a filter hook there on line 232 that you can use to change the archive event page title. Here’s an example of the code you use:

function my_custom_event_archive_title( $title ) {
	if ( is_post_type_archive( 'espresso_events' ) ) {
		$title = 'Upcoming Events';
	}
	return $title;
}
add_filter( 'get_the_archive_title', 'my_custom_event_archive_title' );

You can add the above to a functions plugin or if you’re using a child theme, you put the code into your WordPress child theme’s functions.php file.


info@hrgirlfriends.com

June 1, 2016 at 11:53 am

Thank you so much!


Josh

  • Support Staff

June 1, 2016 at 1:23 pm

Glad you were able to work that out.

The support post ‘Change Archive Event Page Title’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso