Support

Home Forums Event Espresso Premium place an asterisk or symbol next to event name on certain events

place an asterisk or symbol next to event name on certain events

Posted: May 21, 2019 at 12:19 pm

Viewing 7 reply threads


echobrin

May 21, 2019 at 12:19 pm

I have a footnote on my event list page that applies to certain events. Is there a way (other than simply entering an asterisk in the event title) to mark or flag certain events? For example there are certain classes that are entry-level and I’d like to mark those events in the list with an asterisk so that people know to look at the bottom of the list to read the footnote that applies to those types of classes.


Tony

  • Support Staff

May 22, 2019 at 9:49 am

Hi there,

As long as your theme isn’t doing something really strange, you can use the WP filter on the_title for this.

For example:

add_filter('the_title', 'tw_ee_filtered_title', 10, 2);
function tw_ee_filtered_title($title, $id){
	if( is_archive('espresso_events') && get_post_type($id) === 'espresso_events' ) {
		$footnote = get_post_meta($id, 'footnote', true);
		if($footnote) {
			$title .= '*';
		}
	}
	return $title;
}

Note that what that code does is first check if you are viewing the EE event post archive (the default /events/ listing), then confirms that the post ID for this call is for an EE event.

After that’s it pulls a custom field from the event and if that is set adds ‘*’ to the end of the title.

So for the list to show a * you need to set a ‘footnote’ custom field (you can change that in the code above if you want to use a different field) like so – https://monosnap.com/file/ZcFu5ysjcRyMzZPCr7lVb5uIZsAYYX

That will output the event title like this – https://monosnap.com/file/b4aI6Ar4PZetlseyusfofmDOoLsMCs

You can add the above to a You can add that to a custom functions plugin on your site, we have some documentation on creating one here:

https://eventespresso.com/wiki/create-site-specific-plugin-wordpress-site/


Josh

  • Support Staff

May 22, 2019 at 9:56 am

One thing to note: If you use a shortcode to show your event list, like the table template, it will require some different PHP code to add the asterisk there.


echobrin

May 22, 2019 at 10:28 am

Ok, yes I am using a shortcode with the toggle template to display the list.


Tony

  • Support Staff

May 22, 2019 at 11:15 am

So you’re using the EE4 Table view template with this shortcode?

[ESPRESSO_EVENTS_TABLE_TEMPLATE template_file=espresso-events-table-template-toggle.template.php]


echobrin

May 22, 2019 at 12:10 pm

Yes, i’m using [ESPRESSO_EVENTS_TABLE_TEMPLATE template_file=espresso-events-table-template-toggle.template.php show_venues=false table_search=false table_paging=false] and have customized it to include a start date column like this: https://eventespresso.com/topic/ee4-events-table-template-toggle-version-add-date-to-toggle-closed-state/


Josh

  • Support Staff

May 22, 2019 at 12:27 pm

In that case, you’ll make another edit to that template.

In that template you’ll find:

<?php echo $post->post_title; ?>

Immediately following the closing ?> there, you could add:

<?php $footnote = get_post_meta($post->ID, 'footnote', true);
		if($footnote) {
			echo '*';
		}
?>


echobrin

May 22, 2019 at 12:47 pm

That’s perfect, thanks! I also added a class to make the asterisk stand out a little.

Viewing 7 reply threads

The support post ‘place an asterisk or symbol next to event name on certain events’ 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