• After research, I found that this code is used for shortcode for button

    function sButton($atts, $content = null) {
    extract(shortcode_atts(array('link' => '#'), $atts));
    return '<a href="'.$link.'"><span>' . do_shortcode($content) . '</span></a>';
    }
    add_shortcode('button', 'sButton');

    This gives the output link with dofollow.

    But I want to have another shortcode for button that has rel=”nofollow”. Is it possible to 2 such codes in custom_functions.php.

    If so please help me to have such code.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter konasrinivas

    (@konasrinivas)

    Actually that code is without [quote] and [/quote]

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    Fixed the code output.

    You could add yoru own button shortcode.

    function konaButton($atts, $content = null) {
    extract(shortcode_atts(array('link' => '#'), $atts));
    return '<a href="'.$link.'" rel=nofollow.><span>' . do_shortcode($content) . '</span></a>';
    }
    add_shortcode('buttonnofollow', 'konaButton');
    Thread Starter konasrinivas

    (@konasrinivas)

    Hey Thanks ….that’s really nice of you.

    function konaButton($atts, $content = null) {
    extract(shortcode_atts(array('link' => '#'), $atts));
    return '<a rel="nofollow" target="_blank" href="'.$link.'"><span>' . do_shortcode($content) . '</span></a>';
    }
    add_shortcode('buttonnofollow', 'konaButton');

    I suppose, this will be better.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Button Shortcode’ is closed to new replies.