Skip to content

Instantly share code, notes, and snippets.

@BinaryMoon
Created October 9, 2018 08:10
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 BinaryMoon/0420e5290845af5a6acc4f2f54024179 to your computer and use it in GitHub Desktop.
Save BinaryMoon/0420e5290845af5a6acc4f2f54024179 to your computer and use it in GitHub Desktop.
Change the "Recent Posts" title in Opti to "Recent Articles".
<?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