admin
10 years ago
plugins
11 years ago
widget
10 years ago
fixes-archive.php
11 years ago
fixes-dates.php
11 years ago
fixes-get_archives.php
11 years ago
fixes-get_calendar.php
11 years ago
fixes-misc.php
11 years ago
fixes-permalinks.php
11 years ago
general.php
10 years ago
install.php
11 years ago
parsidate.php
11 years ago
settings.php
10 years ago
fixes-archive.php
39 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Fixes archives and make them compatible with Shamsi date |
| 4 | * |
| 5 | * @package WP-Parsidate |
| 6 | * @subpackage Fixes/Archives |
| 7 | * @author Mobin Ghasempoor |
| 8 | */ |
| 9 | |
| 10 | add_filter('wp_title','wpp_fix_title'); |
| 11 | |
| 12 | /** |
| 13 | * Fixes titles for archives |
| 14 | * |
| 15 | * @param string $title Archive title |
| 16 | * @param string $sep Seperator |
| 17 | * @param string $seplocation Seperator location |
| 18 | * @return string New archive title |
| 19 | */ |
| 20 | function wpp_fix_title( $title, $sep = '»', $seplocation = 'right' ) { |
| 21 | global $persian_month_names, $wp_query, $wpp_settings; |
| 22 | $query = $wp_query->query; |
| 23 | |
| 24 | if ( ! is_archive() || ( is_archive() && ! isset( $query['monthnum'] )) || ( $wpp_settings['persian_date'] == 'disable' ) ) |
| 25 | return $title; |
| 26 | |
| 27 | if ( $seplocation == 'right' ) |
| 28 | $query = array_reverse( $query ); |
| 29 | |
| 30 | $query['monthnum'] = $persian_month_names[intval( $query['monthnum'] )]; |
| 31 | |
| 32 | $title = implode( " $sep ", $query ) . " $sep "; |
| 33 | |
| 34 | if ( $wpp_settings['conv_page_title'] != 'disable' ) |
| 35 | $title = fixnumber($title); |
| 36 | |
| 37 | return $title; |
| 38 | } |
| 39 |