Support » Plugin: Events Manager » Changing Labels

  • Resolved dareadel

    (@h2ofilters)


    Hello,
    Is there a way to change the label/slug “event” to another name? We would like to use the plugin for school classes registrations and would like to change the slug to “classes.”

    Thanks,
    Dare

Viewing 3 replies - 1 through 3 (of 3 total)
  • Patrick

    (@duisterdenhaag)

    Hi Dare,

    Where exactly do you want to change it? Different locations ask for a different approach, of course. 😉

    Thanks Patrick. Sorry I didn’t get the notification for your reply but just came here to check.

    I would like to use url/classes instead of url/events. So instead of Add Event it would be Add Classes

    Patrick

    (@duisterdenhaag)

    Okay, first of all, technically it will always remain ‘event’ because that is what EM uses, of course. If you change that, you will need to almost rewrite the whole plugin. 😉

    Changing the url (slug) is easy! 🙂
    Go to Events > Settings > Pages > Permalink Slugs
    The first text field defines what is shown in the url.

    To change the back-end labels, you can hook into the arguments that EM used to register the custom post type. Here’s something to get you started:

    function em_change_cpt_event_labels( $args, $post_type ) {
    	// Make sure we are only changing the correct post type.
    	if( 'event' != $post_type ) { 
    		return $args;
    	}
    
    	$args['label'] = 'Classes';
    	$args['labels'] = array (
    		'name' => 'Classes',
    		'singular_name' => 'Class',
    		'menu_name' => 'Classes',
    		'add_new' => 'Add Class',
    	);
    	return $args;
    }
    add_filter( 'register_post_type_args', 'em_change_cpt_event_labels', 10, 2 );
    

    For a full overview, check out wp-plugins/events-manager/em-posts.php, starting around line 119.

    You would have to create a second function to change the event-recurring’ labels, of course.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Changing Labels’ is closed to new replies.