Title: Button Shortcode
Last modified: August 20, 2016

---

# Button Shortcode

 *  [konasrinivas](https://wordpress.org/support/users/konasrinivas/)
 * (@konasrinivas)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/button-shortcode/)
 * 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](https://wordpress.org/support/users/konasrinivas/)
 * (@konasrinivas)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/button-shortcode/#post-2523860)
 * Actually that code is without [quote] and [/quote]
 *  Moderator [Ipstenu (Mika Epstein)](https://wordpress.org/support/users/ipstenu/)
 * (@ipstenu)
 * 🏳️‍🌈 Advisor and Activist
 * [14 years, 3 months ago](https://wordpress.org/support/topic/button-shortcode/#post-2523911)
 * 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](https://wordpress.org/support/users/konasrinivas/)
 * (@konasrinivas)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/button-shortcode/#post-2524077)
 * 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.

## Tags

 * [Button Shortcode](https://wordpress.org/support/topic-tag/button-shortcode/)

 * In: [Everything else WordPress](https://wordpress.org/support/forum/miscellaneous/)
 * 3 replies
 * 2 participants
 * Last reply from: [konasrinivas](https://wordpress.org/support/users/konasrinivas/)
 * Last activity: [14 years, 3 months ago](https://wordpress.org/support/topic/button-shortcode/#post-2524077)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
