Posted: March 1, 2019 at 6:47 pm
Hi there, One thing i’d like to change though, and I can’t seem to do this with the permalink plugin, is to use only the parent event category in the url. As it is, the function adds all of the selected event categories to the slug. i.e. Instead of “../workshops/2day/act-i-san-diego/” Can you provide any suggestions? |
|
Now I see that using the Permalinks Manager (lite) plugin causes a fatal error to espresso_venue_address() and my event dates. I was using this super helpful code that Josh posted on my site to display the venue addresses in a custom format on my custom event templates. The following error appears, and the dates and times display is also broken: Fatal error: Uncaught Error: Call to a member function name() on null in ../wp-content/themes/astra-child/functions.php:78 Stack trace: #0 ../wp-content/themes/astra-child/page-event-info.php(122): espresso_venue_address() When i deactivate the permalinks manager, everything returns to normal. Do you guys have any ideas about why this plugin might be interacting poorly with EE? Or perhaps you know of an alternative permalinks plugin? I’m using EE 4.9.78.p on WP 5.1. |
|
Actually, i guess i don’t really need to use the permalinks plugin. Please ignore that question. If you could help me get this code (https://gist.github.com/joshfeck/59695d72a11288d7246eb05c01a8e63b) to insert only the parent category into the slug, then everything will be gravy. |
|
Hi there, That function Josh provided does not add all of the slugs to the URL, it adds the first category slug to the URL. For example – https://monosnap.com/file/iSxv1H6ru1MuUMwGTCYDLyVhvNPsW8 Have you changed the ‘Events’ slug, to ‘Workshops’ but also have a category called ‘Workshops’ by any chance? The code from Josh that you mentioned jumps through a lot of hoops to try and make sure it grabs a venue object and the reason it’s blowing up is it can’t find one. So although you aren’t using the other solution now anyway, that code could do with a quick sanity check, where it has:
(get_venue is what is doing a lot of hoop jumping to try and find your venue for you) Right after it add:
Which will jump out of the function if it can’t find a venue and prevent the fatal you posted. |
|
Hi Tony, Sorry, I misrepresented the problem when I wrote that the code added all of the categories. I agree that it only adds one category, but it seems to use the lowest-ranked category, not the parent. thanks, |
|
Hi Hilary, Sure, you can use
For something like:
Note you’ll run into a similar problem if you have multiple ‘parent’ categories on an event. |
|
The support post ‘Custom permalinks’ 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.