Skip to content

Instantly share code, notes, and snippets.

@shazdeh
Created February 6, 2015 10:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shazdeh/af82edb3870b36cce3f0 to your computer and use it in GitHub Desktop.
Save shazdeh/af82edb3870b36cce3f0 to your computer and use it in GitHub Desktop.
WP Jalali and Polylang Compatibility
<?php
/*
Plugin Name: WP Jalali and Polylang Compatibility
Description: Disables WP Jalali when Farsi is not the current language.
*/
function wp_jalali_polylang_compat() {
if( ! function_exists( 'pll_current_language' ) || pll_current_language() == 'fa' )
return;
remove_filter( 'date_i18n', 'ztjalali_ch_date_i18n', 111, 4 );
remove_filter( "post_link", "ztjalali_permalink_filter_fn", 0, 3 );
remove_action( 'pre_get_posts', 'ztjalali_pre_get_posts_filter_fn' );
remove_filter( 'posts_where', 'ztjalali_posts_where_filter_fn' );
remove_filter( 'title_save_pre', 'ztjalali_persian_num' );
remove_filter( 'content_save_pre', 'ztjalali_persian_num' );
remove_filter( 'excerpt_save_pre', 'ztjalali_persian_num' );
remove_filter( 'comment_save_pre', 'ztjalali_persian_num' );
remove_filter( 'pre_comment_content', 'ztjalali_persian_num' );
remove_filter( 'content_save_pre', 'ztjalali_ch_arabic_to_persian' );
remove_filter( 'title_save_pre', 'ztjalali_ch_arabic_to_persian' );
remove_filter( 'excerpt_save_pre', 'ztjalali_ch_arabic_to_persian' );
remove_filter( 'comment_save_pre', 'ztjalali_ch_arabic_to_persian' );
remove_filter( 'pre_comment_content', 'ztjalali_ch_arabic_to_persian' );
remove_filter( 'the_title', 'ztjalali_persian_num' );
remove_filter( 'the_content', 'ztjalali_persian_num' );
remove_filter( 'the_excerpt', 'ztjalali_persian_num' );
remove_filter( 'comment_text', 'ztjalali_persian_num' );
remove_filter( 'the_content', 'ztjalali_ch_arabic_to_persian' );
remove_filter( 'the_title', 'ztjalali_ch_arabic_to_persian' );
remove_filter( 'the_excerpt', 'ztjalali_ch_arabic_to_persian' );
remove_filter( 'comment_text', 'ztjalali_ch_arabic_to_persian' );
remove_filter( 'comments_number', 'ztjalali_persian_num' );
remove_filter( 'wp_list_categories', 'ztjalali_persian_num' );
remove_filter( 'wp_list_categories', 'ztjalali_ch_arabic_to_persian' );
remove_filter( 'wp_title', 'ztjalali_ch_archive_title', 111, 3 );
}
add_action( 'init', 'wp_jalali_polylang_compat' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment