Created
March 6, 2018 19:29
-
-
Save w33zy/6615a57945d871ee16d2167dbee11784 to your computer and use it in GitHub Desktop.
Testing how WordPress handles the parsing of URL params in RTL languages
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: RTL Testing | |
* Plugin URI: https://wzymedia.com | |
* Description: Testing an issue with RTL languages and URL params. | |
* Author: w33zy | |
* Author URI: https://wzymedia.com | |
* Text Domain: rtl-testing | |
* Domain Path: /languages | |
* Version: 0.1.0 | |
* | |
* @package RTL_Testing | |
*/ | |
class RTL_Testing { | |
public static function start() { | |
static $started = false; | |
if ( ! $started ) { | |
self::add_filters(); | |
self::add_actions(); | |
$started = true; | |
} | |
} | |
public static function add_filters() { | |
} | |
public static function add_actions() { | |
add_action( 'init', array( __CLASS__, 'custom_taxonomy' ), 10 ); | |
} | |
public static function custom_taxonomy() { | |
// 'הוצאה לאור' | |
$plural = 'הוצאה'; // Expenditure | |
$single = 'הוצאה'; // Expenditure | |
$tax_name = 'rtl_' . $single; | |
$slug = strtolower( $single ); | |
$opts['hierarchical'] = true; | |
$opts['public'] = true; | |
$opts['query_var'] = $tax_name; | |
$opts['show_admin_column'] = true; | |
$opts['show_in_nav_menus'] = true; | |
$opts['show_tag_cloud'] = true; | |
$opts['show_ui'] = true; | |
$opts['sort'] = ''; | |
$opts['capabilities']['assign_terms'] = 'edit_posts'; | |
$opts['capabilities']['delete_terms'] = 'manage_categories'; | |
$opts['capabilities']['edit_terms'] = 'manage_categories'; | |
$opts['capabilities']['manage_terms'] = 'manage_categories'; | |
$opts['labels']['add_new_item'] = esc_html__( "Add New {$single}", 'rtl-testing' ); | |
$opts['labels']['add_or_remove_items'] = esc_html__( "Add or remove {$plural}", 'rtl-testing' ); | |
$opts['labels']['all_items'] = esc_html__( $plural, 'rtl-testing' ); | |
$opts['labels']['choose_from_most_used'] = esc_html__( "Choose from most used {$plural}", 'rtl-testing' ); | |
$opts['labels']['edit_item'] = esc_html__( "Edit {$single}", 'rtl-testing' ); | |
$opts['labels']['menu_name'] = esc_html__( $plural, 'rtl-testing' ); | |
$opts['labels']['name'] = esc_html__( $plural, 'rtl-testing' ); | |
$opts['labels']['new_item_name'] = esc_html__( "New {$single} Name", 'rtl-testing' ); | |
$opts['labels']['not_found'] = esc_html__( "No {$plural} Found", 'rtl-testing' ); | |
$opts['labels']['parent_item'] = esc_html__( "Parent {$single}", 'rtl-testing' ); | |
$opts['labels']['parent_item_colon'] = esc_html__( "Parent {$single}:", 'rtl-testing' ); | |
$opts['labels']['popular_items'] = esc_html__( "Popular {$plural}", 'rtl-testing' ); | |
$opts['labels']['search_items'] = esc_html__( "Search {$plural}", 'rtl-testing' ); | |
$opts['labels']['separate_items_with_commas'] = esc_html__( "Separate {$plural} with commas", 'rtl-testing' ); | |
$opts['labels']['singular_name'] = esc_html__( $single, 'rtl-testing' ); | |
$opts['labels']['update_item'] = esc_html__( "Update {$single}", 'rtl-testing' ); | |
$opts['labels']['view_item'] = esc_html__( "View {$single}", 'rtl-testing' ); | |
$opts['rewrite']['ep_mask'] = EP_NONE; | |
$opts['rewrite']['hierarchical'] = false; | |
$opts['rewrite']['slug'] = $slug; | |
$opts['rewrite']['with_front'] = false; | |
register_taxonomy( $tax_name, array( 'post' ), $opts ); | |
flush_rewrite_rules( false ); | |
} | |
} | |
RTL_Testing::start(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment