Support

Home Forums Event Espresso Premium hiding events

hiding events

Posted: July 17, 2020 at 11:34 am


Seattle Hadassah

July 17, 2020 at 11:34 am

Hi –

I would like to create an event which is completely hidden. That is to say it will not show up on the calendar or when using the shortcode: [ESPRESSO_EVENTS limit=1 show_title=false].

Currently I can display the calendar without the event but even when the event is private/password protected it shows up on the listing of all events and when the above shortcode is used.

How can I do this?

Regards,
Ricki


Seattle Hadassah

July 19, 2020 at 4:18 pm

To update this what I would like to do is have the events page display only those events within a specified category. Exactly like the shortcode
[ESPRESSO_EVENTS category_slug=event] does. I am not sure how to change the template to accomplish this.

Any and all help appreciated,
Ricki


Tony

  • Support Staff

July 21, 2020 at 1:13 pm

Hi Ricki,

A couple of things stand out from your posts, first:

Currently I can display the calendar without the event but even when the event is private/password protected it shows up on the listing of all events and when the above shortcode is used.

Password protected posts show to all users to allow any users that have the password to view the posts, however…

Private posts will only show to users logged into the site with an Administrator or Editor role, other users (including logged out user) can’t see those posts/events. So are you looking to remove the post from view for everyone, including Admins and Editors?

To update this what I would like to do is have the events page display only those events within a specified category. Exactly like the shortcode
[ESPRESSO_EVENTS category_slug=event] does.

Whilst you could hook into the EE post type archive using the pre_get_posts hook and set it to only load events within a specific category, it sounds more like setting the event to be private would fit your needs better here as there is nothing stopping users from guessing your ‘hidden’ event URL to find the event if it is not set to be private.


Seattle Hadassah

July 21, 2020 at 1:22 pm

Hi Tony,

A better way of explaining what I am trying to do is display only events from one category on the events page.

I can specify that only events for a single category be displayed using the eventespresso widget but the link created by the widget for viewing all events displays events for all categories, what I had expected it to do was only display events from the specified category.

Is there a way of making that happen?


Tony

  • Support Staff

July 21, 2020 at 2:12 pm

Yes, but you would need to customize both the widget output and the archive query to do that as the link to ‘All Events’ just links to the event archive, which as you’ve found, displays all EE event posts.

So to dynamically display only specific events you’d need the widget to pass the event category over within the link and then process that value to filter the events.

So yes, it’s possible but you’ll need some custom development to do it.

Without custom code and just using a snippet, excluding a specific event category from the post archive is fairly simple using the hook I mentioned above, like so:

https://gist.github.com/Pebblo/f4f061193834c9230401255bf2ab965d

Set the ID of the slug you want to exclude (or an array of ID’s) on line 10.

The support post ‘hiding 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