Created
June 10, 2018 15:16
-
-
Save ideadude/901b2c88008798737188f2429ed9a664 to your computer and use it in GitHub Desktop.
Load localized email templates in a WordPress plugin. (BWAWWP Blog)
This file contains hidden or 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 | |
// Gets the full path for an email template given the email filename. | |
function schoolpress_get_email( $email ) { | |
$dir = apply_filters( | |
'schoolpress_emails_path', SCHOOLPRESS_PATH . '/emails/' | |
); | |
return $dir . $image; | |
} | |
// Filters the schoolpress_emails_path value based on locale. | |
// Put this in includes/localization.php | |
function localize_schoolpress_emails_path( $path ) { | |
$locale = apply_filters( 'plugin_locale', get_locale(), 'schoolpress' ); | |
if ( $locale != 'en_US' ) | |
$path = SCHOOLPRESS_PATH . '/languages/' . $locale . '/emails/'; | |
return $path; | |
} | |
add_filter( 'schoolpress_emails_path', 'localize_schoolpress_emails_path' ); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment