corsonr
3/21/2013 - 1:56 PM

Translatable Shortcodes 4

Translatable Shortcodes 4

/**
 * Add the shortcode
 *
 * [link to="www.google.com"]Google[link] 
*/
function rc_trs_link_shortcode( $atts, $content = null ) {
	extract(shortcode_atts(array(
		__('to', 'rc_trs') => 'http://google.com'
	), $atts));
	
	$to = ${__('to', 'rc_trs')};
	
	return '<a href="'.$to.'">'.$content.'</a>';
}

add_shortcode( __('link', 'rc_trs'), 'rc_trs_link_shortcode' );