Skip to content

Instantly share code, notes, and snippets.

@billerickson
Last active April 12, 2016 16:20
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save billerickson/e5466b8680063918032866a5871c6653 to your computer and use it in GitHub Desktop.
Save billerickson/e5466b8680063918032866a5871c6653 to your computer and use it in GitHub Desktop.
<?php
/**
* Load different homepage based on WPML language
* @author Bill Erickson
* @link http://www.billerickson.net/code/load-different-template-based-on-language
*
* @param string $template
* @return string
*/
function be_template_based_on_wpml( $template ) {
if( is_home() && ICL_LANGUAGE_CODE == 'cn' )
$template = get_query_template( 'home-cn' );
return $template;
}
add_filter( 'template_include', 'be_template_based_on_wpml' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment