Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- Plugin Name: Event Espresso - Change "available to members only text"
- Description: Change "available to members only text" on ticket list on event details.
- Author URI:http://www.companyb.ca
- Version: 1.0.0.p
- License: GPL2
- License URI: https://www.gnu.org/licenses/gpl-2.0.html
- Text Domain: wporg
- Domain Path: /languages
- */
- function mycustom_filter_gettext2( $translated, $original, $domain ) {
- // This is an array of original strings
- // and what they should be replaced with
- $strings = array(
- 'The %1$s%2$s%3$s%4$s is available to members only. %5$s' => 'You must login as a member to view the %1$s%2$s%3$s%4$s option. Log-in "<a href="https://www.sogtalks.com/your-profile/login/">here</a>".',
- // Add some more strings here
- );
- // See if the current string is in the $strings array
- // If so, replace its translation
- if ( isset( $strings[$original] ) ) {
- // This accomplishes the same thing as __()
- // but without running it through the filter again
- $translations = get_translations_for_domain( $domain );
- $translated = $translations->translate( $strings[$original] );
- }
- return $translated;
- }
- add_filter( 'gettext', 'mycustom_filter_gettext2', 10, 3 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement