Created
March 4, 2012 03:48
-
-
Save zanematthew/1970589 to your computer and use it in GitHub Desktop.
WordPress Ajax Login -- Load Template
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
<?php | |
/** | |
* loads a template from a specificed path | |
* | |
* @package Ajax | |
* | |
* @uses load_template() | |
* @todo move to zm-ajax or something? | |
*/ | |
function zm_load_template() { | |
$path = dirname( dirname( plugin_dir_path( __FILE__ ) ) ); | |
$template = $path . '/' . $_POST['template']; | |
if ( $template == null ) | |
wp_die( 'Yo, you need a template!'); | |
load_template( $template ); | |
die(); | |
} // zm_load_template | |
add_action( 'wp_ajax_nopriv_zm_load_template', 'zm_load_template' ); | |
add_action( 'wp_ajax_zm_load_template', 'zm_load_template' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment