Created
October 9, 2018 08:10
-
-
Save BinaryMoon/0420e5290845af5a6acc4f2f54024179 to your computer and use it in GitHub Desktop.
Change the "Recent Posts" title in Opti to "Recent Articles".
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: Opti change "Recent Posts" | |
* Plugin URI: https://prothemedesign.com | |
* Description: Change the "Recent Posts" title in Opti to "Recent Articles". | |
* Author: Ben Gillbanks | |
* Version: 1.0 | |
* Author URI: https://prothemedesign.com | |
* Text Domain: broadsheet | |
*/ | |
/** | |
* Change the translatable text to something else. | |
* | |
* @param string $translation The translation to use. | |
* @param string $text The text string being translatec. | |
* @param string $domain The theme domain being used. | |
* @return string | |
*/ | |
function opti_get_text( $translation, $text, $domain ) { | |
// If we're not using Opti then quit. | |
if ( 'opti' !== $domain ) { | |
return $translation; | |
} | |
// Adjust homepage string. | |
if ( 'Recent Posts' === $text ) { | |
return 'Recent Articles'; | |
} | |
// Adjust paged variations. | |
if ( 'Recent Posts - page %d' === $text ) { | |
return 'Recent Articles - page %d'; | |
} | |
return $translation; | |
} | |
add_filter( 'gettext', 'opti_get_text', 10, 3 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment