published){
// This game is drafted
if(is_login() && USER_ADMIN){
// Show message for admin user
echo '
The game has not been published yet and is currently in draft mode.
';
} else {
$game = null;
// Show 404 page for visitor
}
}
if($game){
if($lang_code != 'en'){
// If use translation (localization)
// Begin translate the content if has translation
$translated_fields = get_content_translation('game', $game->id, $lang_code, 'all');
if(!is_null($translated_fields)){
$game->title = isset($translated_fields['title']) ? $translated_fields['title'] : $game->title;
$game->description = isset($translated_fields['description']) ? $translated_fields['description'] : $game->description;
$game->instructions = isset($translated_fields['instructions']) ? $translated_fields['instructions'] : $game->instructions;
}
}
$page_title = $game->title . ' | '.SITE_DESCRIPTION;
$meta_description = str_replace(array('"', "'"), "", strip_tags($game->description));
require( TEMPLATE_PATH . '/game.php' );
} else {
require( ABSPATH . 'includes/page-404.php' );
}
?>