WordPress.org

Ready to get started?Download WordPress

Forums

qTranslate
Meta keywords and description on page localized (2 posts)

  1. Peter
    Member
    Posted 1 year ago #

    Is there any posibility to define separate meta keywords and description on page for each language?

    http://wordpress.org/extend/plugins/qtranslate/

  2. C S
    Member
    Posted 1 year ago #

    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'>";

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic