-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow multiple categories to be used in ESPRESSO_EVENTS #3125
Conversation
…he categories passed.
…m each element in the array to remove whitespaces Use $event_category_slugs_array to build out an placeholder string to be used with prepare. (Count the number of slugs and add N number of placeholders to a string) Switch to use IN in the SQL query and pass both $event_category_slugs_prepare and $event_category_slugs_array to prepare.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ummm... think this needs a fix still
return sanitize_title_with_dashes(EE_Registry::instance()->REQ->get('event_query_category', $category)); | ||
return sanitize_text_field(EE_Registry::instance()->REQ->get('event_query_category', $category)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ya this looks great, good job 💯
This works as expected. Nice work! |
…tiple categories to be used in ESPRESSO_EVENTS (#3125) * Switch to sanitize_text_field() so that dashes aren't stripped from the categories passed. * Build out $event_category_slugs_array from whatever is passed and trim each element in the array to remove whitespaces Use $event_category_slugs_array to build out an placeholder string to be used with prepare. (Count the number of slugs and add N number of placeholders to a string) Switch to use IN in the SQL query and pass both $event_category_slugs_prepare and $event_category_slugs_array to prepare. * Add braces around $event_category_slugs_prepare * Style fixes."
See: https://eventespresso.com/topic/multiple-categories-in-shortcode-filter/
From the above request I start looking into do it via a support token, ended up finding:
https://events.codebasehq.com/projects/event-espresso/tickets/7323
How has this been tested
Add something like
[ESPRESSO_EVENTS category_slug=cat-1]
to a page.Confirm that events set to that category show up and not others.
Change is to
[ESPRESSO_EVENTS category_slug='cat-1']
(Note the single quotes, because people do it)..Then change that to
[ESPRESSO_EVENTS category_slug=cat-1,cat-2]
(Note no quotes required as there isn't a space in the shortcode)
Now check that event from both cat-1 and cat-2 show up.
Then change that to
[ESPRESSO_EVENTS category_slug='cat-1, cat-2']
(single quotes required as there's a space this time)
Again confirm that the expected events show up.
Checklist
esc_html__()
, see https://codex.wordpress.org/I18n_for_WordPress_Developers)