-
-
Save ahmadawais/6b986735aa2f2e36a60b939cf8b30925 to your computer and use it in GitHub Desktop.
wp-custom-routes.js
This file contains 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
// Registering custom routes. | |
site.itSales = site.registerRoute( 'sales/v1', '/resource/(?P<some_part>\\d+)' ); | |
site.itSales().somePart( 7 ); // => myplugin/v1/resource/7 | |
// Query Parameters & Filtering Custom Routes. | |
site.handler = site.registerRoute( 'sales/v1', 'receipts/(?P<id>)', { | |
// Listing any of these parameters will assign the built-in | |
// chaining method that handles the parameter: | |
params: [ 'before', 'after', 'author', 'parent', 'post' ] | |
}); | |
// Yields from the custom data of buyers. | |
site.handler().post( 8 ).author( 92 ).before( dateObj )... // Sent to paddle. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment