Advertisement
ozh

Conditionally load YOURLS lang

ozh
Nov 22nd, 2013
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.47 KB | None | 0 0
  1. <?php
  2. /*
  3. Plugin Name: FR or EN ?
  4. Plugin URI: http://yourls.org/
  5. Description: Load FR or EN depending on something
  6. Version: 0.1
  7. Author: Ozh
  8. Author URI: http://ozh.org/
  9. */
  10.  
  11. // Hook into 'get_locale' filter
  12. yourls_add_filter( 'get_locale', 'fr_or_en_select' );
  13.  
  14. // Return 'fr_FR' or 'en_US' depending on something
  15. function fr_or_en_select() {
  16.     // test something here
  17.     if( ...?.... ) {
  18.         $locale = 'fr_FR';
  19.     } else {
  20.         $locale = 'en_US';
  21.     }
  22.  
  23.     return $locale;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement