Skip to content
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

Example of js hooks #768

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Example of js hooks #768

wants to merge 2 commits into from

Conversation

goldenapples
Copy link
Contributor

Example of js hook in post select ajax data, see discussion in #767 (comment)

With this in place, you would filter the data being sent with the ajax request something like

wp.shortcake.hooks.addFilter( 'shortcode_tag.attr.ajax-data', function addParams( response ) {
  response.date_query = $( date_query_field ).value;
  return response;
} )

and add any new arguments to the return value you want.

jaredcobb and others added 2 commits August 24, 2017 16:04
Adds a hook where the data sent along with the search request for a
select2 field can be filtered, for cases where the user wants to use the
value of one field to affect the search results returned for another.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants