Skip to content

Instantly share code, notes, and snippets.

@richtabor
Forked from kailoon/translation.php
Last active May 25, 2017 14:55
Show Gist options
  • Save richtabor/b1317517f53d7943c7f76da48c4468a3 to your computer and use it in GitHub Desktop.
Save richtabor/b1317517f53d7943c7f76da48c4468a3 to your computer and use it in GitHub Desktop.
<?php
// These are incorrect:
__( 'Some String', 'text-domain' ); _e( 'Some string', 'text-domain' );
// Instead, use:
esc_html__( 'Some String', 'text-domain' ); esc_html_e( 'Some String', 'text-domain' );
/**
* For strings with necessary HTML, use the following:
* Note that I'm only including the actual allowed HTML for this specific string.
* More info: https://codex.wordpress.org/Function_Reference/wp_kses
*/
$allowed_html_array = array(
'a' => array(
'href' => array(),
),
'span' => array(
'class' => array(),
)
);
wp_kses( __( '<span class="powered-by"><a href="https://wordpress.org/">Proudly Powered by WordPress</a></span>', 'text-domain' ), $allowed_html_array );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment