Support

Home Forums Event Espresso Premium SEO Meta tags

SEO Meta tags

Posted: March 19, 2014 at 2:20 pm

Viewing 2 reply threads


David Mammano

March 19, 2014 at 2:20 pm

Is there way to control Event Meta Description and Keywords?


Josh

  • Support Staff

March 19, 2014 at 5:37 pm

Hi David,

There likely is, it will help to know which version of Event Espresso you are using. If it’s Event Espresso 4 then you’ll likely be able to use an SEO plugin (or a theme like Genesis) because the events are custom post types.

In Event Espresso 3 it’s a bit different because events are not posts, but there are ways to dynamically set the Meta tags for an event. For example, if you want to change the Meta title tag, you can add some little functions like these to your site’s custom functions file:

/**
 * Creates a nicely formatted and more specific title element text
 * for output in head of document, based on current event.
 *
 */
function ee_reg_page_title( $title, $sep ) {

	// only do stuff if espresso_get_event exists
	if ( function_exists('espresso_get_event') ) {
		global $this_event_id;

		if (isset($this_event_id) && !empty($this_event_id)){
			$event_id = $this_event_id;
		}
		
		if ( empty( $event_id ) ) return $title ; //get out this isn't an ee page.
		
		$event = espresso_get_event( $event_id );

		//one more sanity check
		if ( empty( $event ) ) return $title; //get out we don't have an event.

		if ( $event_id ) { // if there's an event id...do stuff...
			$event = espresso_get_event( $event_id );

			$title = '';
	
			// Add the site name.
			 
			$title .= get_bloginfo( 'name' );	
	
			$title = "$event->event_name $sep $title";
	
			return $title;

		}
	}
}

add_action( 'action_hook_espresso_social_display_buttons', 'ee_mod_page_title');

function ee_mod_page_title() {
	add_filter( 'wp_title', 'ee_reg_page_title', 10, 2 );
}


David Mammano

March 20, 2014 at 6:42 am

We’re using Version 3.1.36.4.P. I’ll work on applying the code you provided. Thanks!

Viewing 2 reply threads

The support post ‘SEO Meta tags’ 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