Changeset 841660
- Timestamp:
- 01/20/2014 09:07:55 AM (12 years ago)
- Location:
- language-mix/trunk
- Files:
-
- 4 added
- 2 edited
-
language-mix.php (modified) (4 diffs)
-
languages/language-mix-ru_RU.mo (added)
-
languages/language-mix-ru_RU.po (added)
-
languages/language-mix-uk.mo (added)
-
languages/language-mix-uk.po (added)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
language-mix/trunk/language-mix.php
r837421 r841660 35 35 require_once(ABSPATH . 'wp-admin/includes/plugin.php'); 36 36 37 $author_rules_backup = array(); 38 37 39 /** 38 40 * Iterrupt plugin activation if Polylang is not activated/installed … … 124 126 } else if (is_category() || is_tag() || is_tax()) { 125 127 $term = get_queried_object(); 126 $translations = pllx_get_translations_with_children($term->term_id, $term->taxonomy );128 $translations = pllx_get_translations_with_children($term->term_id, $term->taxonomy, $slugs); 127 129 128 130 if (count($translations) > 0) { … … 274 276 275 277 /** 278 * Make a copy of author rules 279 */ 280 function pllx_backup_author_rules($rules) { 281 global $author_rules_backup; 282 $author_rules_backup = $rules; 283 return $rules; 284 } 285 add_filter('author_rewrite_rules', 'pllx_backup_author_rules'); 286 287 /** 288 * Restore author rules 289 */ 290 function pllx_rewrite_rules($rules) { 291 global $author_rules_backup; 292 return $author_rules_backup + $rules; 293 } 294 add_filter('rewrite_rules_array', 'pllx_rewrite_rules'); 295 296 # TODO same for date and search? etc? 297 298 /** 299 * Remove link from author URL 300 */ 301 function pllx_author_link($link) { 302 global $polylang; 303 return $polylang->links_model->remove_language_from_link($link); 304 } 305 add_filter('author_link', 'pllx_author_link', 30); 306 307 /** 276 308 * Get all translations of the term (including children) 277 309 */ 278 function pllx_get_translations_with_children($term_id, $taxonomy ) {310 function pllx_get_translations_with_children($term_id, $taxonomy, $languages) { 279 311 global $polylang; 280 312 … … 283 315 284 316 foreach ($term_translations as $language => $term_id) { 285 $term = get_term($term_id, $taxonomy); 286 if ($term) { 287 $translations[] = $term->term_taxonomy_id; 288 289 $term_children = get_term_children($term_id, $taxonomy); 290 291 foreach ($term_children as $term_child) { 292 $term = get_term($term_child, $taxonomy); 293 if ($term) { 294 $translations[] = $term->term_taxonomy_id; 317 if (in_array($language, $languages)) { 318 $term = get_term($term_id, $taxonomy); 319 if ($term) { 320 $translations[] = $term->term_taxonomy_id; 321 322 $term_children = get_term_children($term_id, $taxonomy); 323 324 foreach ($term_children as $term_child) { 325 $term = get_term($term_child, $taxonomy); 326 if ($term) { 327 $translations[] = $term->term_taxonomy_id; 328 } 295 329 } 296 330 } -
language-mix/trunk/readme.txt
r837690 r841660 53 53 54 54 1. The Languages widget, which allows to configure shown languages (uses theme) 55 2. The Translations widget s, which lets switching between translations (uses theme)55 2. The Translations widget, which lets switching between translations (uses theme) 56 56 57 57 == Changelog == … … 79 79 *(English and Russian)* can be found [here](http://blog.andriylesyuk.com/the-nature-of-euromaidan/). 80 80 81 == Credits == 82 83 Thanks to: 81 == Thanks to == 84 82 85 83 * [Francesco De Comite](http://www.flickr.com/photos/fdecomite/) for
Note: See TracChangeset
for help on using the changeset viewer.