Skip to content

Instantly share code, notes, and snippets.

@grappler
Last active August 29, 2015 13:57
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 grappler/9719579 to your computer and use it in GitHub Desktop.
Save grappler/9719579 to your computer and use it in GitHub Desktop.
<?php
// Original hardcoded text
echo 'Click <a href="'. esc_url( get_permalink() ) . '">here</a> to go and watch the video.';
// Option 1
printf(
__( 'Click <a href="%s">Here</a> to go and watch the video.', 'text-domain' ),
esc_url( get_permalink() )
);
// Option 2
printf(
__( 'Click %shere%s to go and watch the video.', 'text-domain'),
'<a href="'. esc_url( get_permalink() ) . '">',
'</a>'
);
// Option 3
printf(
__( 'Click %s to go and watch the video.', 'text-domain' ),
'<a href="'. esc_url( get_permalink() ) . '">' . __( 'here', 'text-domain' ) . '</a>'
);
// Alternative option
echo '<a href="' . esc_url( get_permalink() ) . '">' . __( 'Watch the video', 'text-domain' ) . '</a>';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment