WordPress.org

Support

Support » Plugins and Hacks » qTranslate » Meta keywords and description on page localized

Meta keywords and description on page localized

Viewing 1 replies (of 1 total)
  • Yes.
    I did it with 3 user-defined fields in the backend:
    meta-decription-de
    meta-decription-en
    meta-decription-fr

    then, in the HTML template, you need to check the language and select the appropriate meta-field:

    //	$language = $_GET['lang']; // if using query mode
    //	$language = $q_config["language"]; // if using folder mode
    
    		$field = 'meta-description-'.$language;
    
    		// get data for META-Tag 'description' from DB
    		$metadaten = get_post_meta($post->ID, $field, true);
    
    		// if found anything, use it; if not, use default text
    		if ("" == $metadaten) {
    			switch ($language) {
    				case 'de':
    					$metadaten = "my german default";
    					break;
    
    				case 'en':
    				$metadaten = "my english default";
    					break;
    
    				case 'fr':
    				$metadaten = "my french default";
    					break;
    
    				default:
    				$metadaten = "my default default";
    					break;
    			} // end switch
    		} // end if
    
    		echo "<meta name='description' content='$metadaten'>";
Viewing 1 replies (of 1 total)
  • The topic ‘Meta keywords and description on page localized’ is closed to new replies.
Skip to toolbar