Posted: February 21, 2014 at 11:19 am
|
Hey, We already have a main part of site using slug /events can we change the custom post type of ee4 to say.. /tickets? |
Hi Shaun, You can make this change in EE4. Here is an example: add_filter( 'FHEE__EE_Register_CPTs__register_CPT__rewrite', 'my_custom_event_slug', 10, 2 ); function my_custom_event_slug( $slug, $post_type ) { if ( $post_type == 'espresso_events' ) { $custom_slug = array( 'slug' => 'tickets' ); return $custom_slug; } return $slug; } It should be added to your theme’s functions.php file. Cheers —
|
|
|
Awesome and thanks for quick response. One follow up. Is /tickets a good idea or does EE use that slug for any of the ticketing add ons? Might as well get it right from the start. |
Hi Shaun, You can use any slug that you would like that is not already in use by WordPress. I provided an example for tickets since you mentioned that in your original post. This won’t affect how the Ticketing add-on works. Let us know if there is anything else we can help with. Just open a new support topic through the Event Espresso Support Forums. Have an awesome Friday! — |
|
|
Hey hope this still gets through or I can open a new topic. So we used the code above to change the ee4 slug to /tickets. We created the page /tickets and added the [ESPRESSO_EVENTS] shortcode. The page will not load. When we add the shortcode to the /events page the listing page loaded. When we try to load a single event, which still has the /tickets/event name, the page will not load. I noticed on the general settings page, it still has the event listing URL as /events I noticed the newest release solved a similar issue for event listing and detail page. I am wondering if that means we need to add some more changes to our code to change the slug. Please let me know if we are missing anything |
Could you relocate the filter towards the middle of your theme’s functions.php file? add_filter( 'FHEE__EE_Register_CPTs__register_CPT__rewrite', 'my_custom_event_slug', 10, 2 ); function my_custom_event_slug( $slug, $post_type ) { if ( $post_type == 'espresso_events' ) { $custom_slug = array( 'slug' => 'tickets' ); return $custom_slug; } return $slug; } Then please go to WP-admin –> Settings –> Permalinks and resave the existing settings to flush the existing permalinks. Let me know if this helps. — |
|
|
Hi Shaun, It happens to turn out that the CPT slug and a page are two different things. When Event Espresso registers the custom post type there cannot be a page with the same slug. You will need to trash the tickets page if you want to use tickets as the CPT slug. A page that has [ESPRESSO_EVENTS] on it will display a list of events that you can filter with parameters. It does not replace the custom post type archive. |
|
Hey, Josh we tried it without the slug and it was not loading, so we tried adding the slug and the short code with as maybe a possibility. We just removed the slug, refreshed perms links and we are having the same no load issue. I went through all items to make sure the slug did not exist. I am looking to have this work in conjunction with the event platform I already have on the site. I might be missing this somewhere, but is there a location for all ee4 shortcodes? Maybe that will be enough to get this thing rolling. Going through shortcode documentation I feel as if I end up in some ee3 info by mistake. Knowing exactly what shortcodes I currently have available for ee4 would be awesome….like I said this might be me just missing it somewhere. Thanks. |
|
The location of the shortcode info is inside the Event Espresso 4 Help and Support tab in the WP admin. You might have better success with the custom post type slug function if you place it into a snippet plugin. Your theme’s functions.php file may be loading the function too late. |
The support post ‘How do we change the custom post type slug for ee4’ 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.