WordPress.org

Support

Support » Plugins and Hacks » [Plugin: CF Internal Link Shortcode] Support for other attributes?

[Plugin: CF Internal Link Shortcode] Support for other attributes?

Viewing 1 replies (of 1 total)
  • Would this revision do it: ???

    function cfplsc_shortcode($atts, $wrapped = null) {
    	extract(shortcode_atts(array(
    		'id' => null,
    		'text' => null,
    		'class' => null,
    		'rel' => null,
    		'title' => null,
    		'target' => null
    	), $atts));
    	$wrapped = trim($wrapped);
    	if (!empty($wrapped)) {
    		$text = $wrapped;
    	}
    	$text = trim($text);
    	$id = intval($id);
    	if (empty($id)) {
    		return $text;
    	}
    	$url = get_permalink($id);
    	if (empty($text)) {
    		$text = get_the_title($id);
    	}
    	empty($class) 	? $class = '' 	: $class = 		' class="'.esc_attr($class).'"';
    	empty($rel) 	? $rel = '' 	: $rel = 		' rel="'.esc_attr($rel).'"';
    	empty($title) 	? $title = '' 	: $title = 		' title="'.esc_attr($title).'"';
    	empty($target) 	? $target = '' 	: $target = 	' target="'.esc_attr($target).'"';
    	return '<a>'.esc_html($text).'</a>';
    }
Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: CF Internal Link Shortcode] Support for other attributes?’ is closed to new replies.