Skip to content

Instantly share code, notes, and snippets.

@zanematthew
Created March 4, 2012 03:48
Show Gist options
  • Save zanematthew/1970589 to your computer and use it in GitHub Desktop.
Save zanematthew/1970589 to your computer and use it in GitHub Desktop.
WordPress Ajax Login -- Load Template
<?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