Posted: July 17, 2020 at 11:34 am
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?
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
Any and all help appreciated,
A couple of things stand out from your posts, first:
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?
Whilst you could hook into the EE post type archive using the
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?
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:
Set the ID of the slug you want to exclude (or an array of ID’s) on line 10.