• Resolved dr_who20

    (@dr_who20)


    1) Copy the complete “flags” dir to your “img dir” or “images” dir in your theme.

    2) follow the normal install procedure of the plugin: https://www.ads-software.com/extend/plugins/012-ps-multi-languages/installation/

    3) Replace the following code in line 22: /wp-content/plugins/012-ps-multi-languages/config/functions.php

    $multilingual_snippet = $ps_multi_languages->ps_012_multilingual_list( $lang );
    		if ( !$echo ):
    			return $multilingual_snippet;
    		endif;
    
    		$html .= '<ul class="snippet">'. "\n";
    
    		foreach ( $multilingual_snippet as $key => $val ){
    			$current = $val['current'] ? ' class="'.$val['current'].'" ' : '';
    			$html .= '<li'. $current .'>' . "\n";
    			$html .= '<a href="'.$val['url'].'">'.$val['name'].'</a>' . "\n";
    			$html .= '</li>' . "\n";
    		}
    		$html .= '</ul>'. "\n";
    
    		echo $html;
    	}

    To:

    $multilingual_snippet = $ps_multi_languages->ps_012_multilingual_list( $lang );
    		if ( !$echo ):
    			return $multilingual_snippet;
    		endif;
    
    		$html .= '<ul class="snippet">'. "\n";
    
    		foreach ( $multilingual_snippet as $key => $val ){
    			$current = $val['current'] ? ' class="'.$val['current'].'" ' : '';
    			$flags_dir = get_bloginfo('template_directory');
       //Put correct flag dir Url here:
    		$flags_dir .= '/img/flags/';
    		$flag_icon = $flags_dir . $key . '.png';
    $flag_icon = '<img src="'.$flag_icon.'" style="float:right;margin:2px;padding:1px;border:1px solid #021a40;background-color:#ff0>"';
    			$html .= '<a href="'.$val['url'].'">'.$flag_icon.'</a>&nbsp';
    	}
    
    	echo $html;
    	}

    4) Put the following code in your theme “header.php” between <head>...</head> where you want the flags to display:

    <?php if ( function_exists( 'ps_012_multilingual_list' ) ) $gs = ps_012_multilingual_list() ; ?>

    That will do the trick.

Viewing 1 replies (of 1 total)
  • Great, but just a small caution – if the plug-in is ever upgraded, the changes in function.php may be run-over. Users should remember to re-apply their changes to the new version of function.php.

    There a bunch of commented-out code for adding multi-language support for media files, so it’s possible that an upgrade is in the works (hope so, anyway).

Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: 012 Ps Multi Languages] This is how i put language flags on my page’ is closed to new replies.