Skip to content

Instantly share code, notes, and snippets.

@korynorthrop
Created May 26, 2020 13:40
Show Gist options
  • Save korynorthrop/470293b1f7126207f31a3fdc5cc5428e to your computer and use it in GitHub Desktop.
Save korynorthrop/470293b1f7126207f31a3fdc5cc5428e to your computer and use it in GitHub Desktop.
Autoptimize RTL filter
<?php
public function rtl_logic( $input_condition ) {
if ( is_rtl() || strpos( $_SERVER['REQUEST_URI'], '/ar/' ) !== false || strpos( $_SERVER['REQUEST_URI'], '/he/' ) !== false || strpos( $_SERVER['REQUEST_URI'], '/fa/' ) !== false || strpos( $_SERVER['REQUEST_URI'], '/ur/' ) !== false ) {
error_log( "path-based rule set for: " . $_SERVER['REQUEST_URI'] );
return true;
} else {
error_log( "conditional tag used for: " . $_SERVER['REQUEST_URI'] );
if ( is_single() ) {
error_log( "and is_single() is true for: " . $_SERVER['REQUEST_URI'] );
}
return $input_condition;
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment