Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Gist pour illustrer la redirection du template, si la requête est faite en ajax, sur l'article de BoiteAWeb
add_filter( 'template_include', 'baw_template_include' );
function baw_template_include( $template ) {
if( isset( $_SERVER['HTTP_X_REQUESTED_WITH'] ) && $_SERVER['HTTP_X_REQUESTED_WITH']== 'BAWXMLHttpRequest' ):
$pre = dirname( $template );
$suf = basename( $template );
$_template = $pre . '/ajax-' . $suf;
if( !file_exists( $_template ) )
$_template = $template;
$template = $_template;
endif;
return $template;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.