Last active
September 8, 2019 06:59
-
-
Save th-santos/cd9fe816bb8de07cd1d34aeb8c7a2229 to your computer and use it in GitHub Desktop.
Using "gettext" WordPress filter to change the string "Page ... of ..." of Rank Math plugin in the <title> tag.
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 | |
/** | |
* Change the string "Page ... of ..." of Rank Math plugin in the <title> tag | |
* | |
* @link http://codex.wordpress.org/Plugin_API/Filter_Reference/gettext | |
* @link https://developer.wordpress.org/themes/basics/conditional-tags/#testing-for-paginated-pages | |
* | |
*/ | |
function my_text_strings($translated_text) { | |
global $wp_query; | |
$paged = $wp_query->get('page'); | |
if ($paged > 1 && $translated_text == 'Page %1$d of %2$d') { | |
$translated_text = __('Página %1$d de %2$d', 'rank-math'); | |
} | |
return $translated_text; | |
} | |
add_filter('gettext', 'my_text_strings', 20); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment