Last active
September 7, 2015 21:18
-
-
Save uncatcrea/074d906e72b09550c362 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
//In app's theme (functions.js) | |
/** | |
The following allows to create a custom screen on app side only | |
(meaning it does not correspond to an existing WordPress page or post). | |
In this example, the page is accessed at the "url" #my-page-route and | |
uses the template 'my-page-template' to render. Last arguments allows to pass | |
custom data to the template. | |
*/ | |
App.addCustomRoute( 'my-page-route', 'my-page-template', { some_data : 'for the template' } ); | |
/** | |
And if you want to pass dynamic data to the template, you can use the | |
'template_args' filter : | |
*/ | |
App.filter( 'template-args', function( template_args, view_type, view_template ) { | |
if( view_template == 'my-page-template' ) { | |
template_args.my_custom_arg = { my: custom_dynamic_value }; | |
} | |
return template_args; | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment