Advertisement
CompanyB

Event Espresso Membership text

Apr 10th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1. <?php
  2. /*
  3. Plugin Name: Event Espresso - Change "available to members only text"
  4. Description: Change "available to members only text" on ticket list on event details.
  5. Author URI:http://www.companyb.ca
  6. Version: 1.0.0.p
  7. License: GPL2
  8. License URI: https://www.gnu.org/licenses/gpl-2.0.html
  9. Text Domain: wporg
  10. Domain Path: /languages
  11. */
  12.  
  13. function mycustom_filter_gettext2( $translated, $original, $domain ) {
  14.  
  15. // This is an array of original strings
  16. // and what they should be replaced with
  17.  
  18. $strings = array(
  19. '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>".',
  20. // Add some more strings here
  21. );
  22.  
  23. // See if the current string is in the $strings array
  24. // If so, replace its translation
  25. if ( isset( $strings[$original] ) ) {
  26. // This accomplishes the same thing as __()
  27. // but without running it through the filter again
  28. $translations = get_translations_for_domain( $domain );
  29. $translated = $translations->translate( $strings[$original] );
  30. }
  31.  
  32. return $translated;
  33. }
  34.  
  35. add_filter( 'gettext', 'mycustom_filter_gettext2', 10, 3 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement