Created
October 13, 2015 19:47
-
-
Save joehoyle/c5b48707aeee116bc6a4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
this.$el.find( '.taxonomy-terms' ).select2({ | |
multiple: true, | |
ajax: { | |
url: WP_API_Settings.root + 'wp/v2/terms/' + this.options.taxonomy.slug, | |
data: function( term, page ) { | |
return { | |
search: term, | |
page: page, | |
_envelope: true | |
} | |
}, | |
results: function( data, page ) { | |
return { | |
results: data.body.map( function( term ) { | |
return { text: term.name, id: term.id }; | |
} ), | |
more: data.headers['X-WP-TotalPages'] > page | |
} | |
} | |
}, | |
width: '100%' | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment