Home › Forums › Calendar Products › Community Events › HIding unnamed/blank venues & organizers from choices
- This topic has 4 replies, 3 voices, and was last updated 7 years, 1 month ago by William.
-
AuthorPosts
-
March 14, 2017 at 11:15 am #1253996WilliamParticipant
Greetings! I was wondering if it would be possible to hide blank venues/organizer names from the choices when a user is filling out the community event submission form.
I asked a similar question last year for the Filter Bar, which generated two options, both of which worked.
To sum it up, because we use info from the venues and organizer fields in an exported version of this calendar for print, we regularly end up with no-name venues and organizers (e.g. meeting at a particular address for a hike, or contact info from an organizer who doesn’t want their name out there). As a result the dropdown menu for venue and organizer have a bunch of empty entries.
Try as I might — with chrome inspector looking for elements for the jquery option and in the community files for a hook that might allow a version of option 2 to work — I wasn’t able to adapt these to the community page.
March 15, 2017 at 10:06 am #1254622BarryMemberHi William,
Great question!
Please keep in mind first of all that the degree of support we can offer for tasks requiring custom dev work tends to be rather limited. I certainly see the utility of your request, though, so would love to offer you some code that may – at the least – serve as a starting point you can build on as needed.
function remove_empty_linked_posts_init() { add_filter( 'tribe_events_linked_posts_query', 'remove_empty_linked_posts_setup' ); } function remove_empty_linked_posts_setup( $passthru ) { add_filter( 'the_posts', 'remove_empty_linked_posts' ); return $passthru; } function remove_empty_linked_posts( $posts ) { $revised_post_list = array(); remove_filter( 'the_posts', 'remove_empty_linked_posts' ); foreach ( $posts as $candidate_post ) { $post_title = trim( $candidate_post->post_title ); if ( ! empty( $post_title ) ) { $revised_post_list[] = $candidate_post; } } return $revised_post_list; } add_action( 'tribe_pre_get_template_part_community/modules/venue', 'remove_empty_linked_posts_init' );
The above code, which you could add to a custom plugin (or, if you need to, your theme/child theme’s functions.php file) should successfully remove any venues from the Community Events submission form that have an empty post title.
Does that help at all? Good luck with the project!
March 15, 2017 at 2:06 pm #1254737WilliamParticipantThanks! It worked.
March 15, 2017 at 5:30 pm #1254825BarryMemberFantastic 🙂
-
AuthorPosts
- The topic ‘HIding unnamed/blank venues & organizers from choices’ is closed to new replies.