Support » Plugin: WP Shortcode by MyThemeShop » No follow

Viewing 1 replies (of 1 total)
  • Plugin Author MyThemeShop

    (@mythemeshop)

    Hello,

    Kindly append the following to your theme’s functions.php:

    
    function wp_shortcode_init() {
    	remove_shortcode( 'button-green' );
    	add_shortcode( 'button-green', 'wp_shortcode_button_green' );
    }
    add_action( 'init', 'wp_shortcode_init' );
    
    function wp_shortcode_button_green( $atts, $content = null ) {
        extract(shortcode_atts(array(
    		'url'     	 => '#',
    		'target'     => '_self',
    		'position'   => 'left',
    		'rel' => 'external',
        ), $atts));
    	$out = "<a rel=\"" . esc_attr( $rel ) . "\" href=\"" .$url. "\" target=\"" .$target. "\" class=\"buttons btn_green " .$position. "\"><span class=\"left\">".do_shortcode($content)."</span></a>";
        if ($position == 'center') {
            $out = '<div class="button-center">'.$out.'</div>';
        }
        return $out;
    }
    

    You can then use the shortcode as:

    
    [button-green rel="nofollow"]Hi[/button-green]
    

    Thank you

Viewing 1 replies (of 1 total)
  • The topic ‘No follow’ is closed to new replies.