Forum Replies Created
-
AuthorPosts
-
January 22, 2018 at 7:03 am in reply to: Filter bar not showing up while logged into WordPress #1432313
Sabina Ramsey
ParticipantThis reply is private.
January 17, 2018 at 7:08 am in reply to: Filter bar not showing up while logged into WordPress #1428452Sabina Ramsey
ParticipantAnd the filter bar also appears to not load on mobile either.
January 17, 2018 at 6:56 am in reply to: Filter bar not showing up while logged into WordPress #1428444Sabina Ramsey
ParticipantSorry trying to edit my first message but I’m getting a “ERROR: Forum ID is missing.” Please ignore the second paragraph, I’m still testing and the button seems that it will work, but the filter bar is still missing when logged in.
January 17, 2018 at 6:54 am in reply to: Filter bar not showing up while logged into WordPress #1428443Sabina Ramsey
ParticipantThis reply is private.
Sabina Ramsey
ParticipantI actually found on the user voice page than an Admin had posted a code snippet that works for this: https://gist.github.com/cliffordp/eb2753491526b079ba69882f4be4fafc and it seems to work great. I upvoted the feature as well for being a built-in option with the filter bar.
Sabina Ramsey
ParticipantI kept searching around online for anyone else who was trying to accomplish this and it seems that this code works, just wanted to share it for anyone else trying this.
// Exclude past events from search function mySearchFilter($query) { if ($query->is_search) { $past_events = tribe_get_events( array( 'posts_per_page' => -1, 'end_date' => new DateTime() ) ); $exclude_events = []; foreach ( $past_events as $past_event ) { $exclude_events[] = $past_event->ID; } $query->set('post__not_in', $exclude_events); } return $query; } add_filter('pre_get_posts','mySearchFilter');-
This reply was modified 8 years, 8 months ago by
Sabina Ramsey.
Sabina Ramsey
ParticipantThis reply is private.
Sabina Ramsey
ParticipantI’ve added that code, tried flushing out the cache and checked again and I am still seeing past events.
Sabina Ramsey
ParticipantActually sorry scratch that error, I figured out what that was from, but it seems that I’m still seeing some past events show up if I search for their title.
Sabina Ramsey
ParticipantI tried adding that code with and with the search plugin I had been attempting to use (Relevanssi) deactivated and activated I was getting this error when I clicked to search:
Fatal error: Uncaught Error: [] operator not supported for strings in /home/sitename/public_html/dev/wp-content/themes/polyclinic-child/functions.php:161 Stack trace: #0 /home/sitename/public_html/dev/wp-includes/class-wp-hook.php(298): edcny_pre_get_posts(Object(WP_Query)) #1 /home/sitename/public_html/dev/wp-includes/class-wp-hook.php(323): WP_Hook->apply_filters(NULL, Array) #2 /home/sitename/public_html/dev/wp-includes/plugin.php(515): WP_Hook->do_action(Array) #3 /home/sitename/public_html/dev/wp-includes/class-wp-query.php(1683): do_action_ref_array(‘pre_get_posts’, Array) #4 /home/sitename/public_html/dev/wp-includes/class-wp-query.php(3248): WP_Query->get_posts() #5 /home/sitename/public_html/dev/wp-includes/class-wp.php(617): WP_Query->query(Array) #6 /home/sitename/public_html/dev/wp-includes/class-wp.php(735): WP->query_posts() #7 /home/sitename/public_html/dev/wp-includes/functions.php(955): WP->main(”) #8 /home/sitename/public_html/dev/wp-blog-header.php(16): in /home/sitename/public_html/dev/wp-content/themes/polyclinic-child/functions.php on line 161
Sabina Ramsey
ParticipantDefinitely thought I had already tried that but it worked! Thank you!
-
This reply was modified 8 years, 8 months ago by
-
AuthorPosts
