Title: [Plugin: Shortcodes Ultimate] Using shortcode in another plugin
Last modified: August 19, 2016

---

# [Plugin: Shortcodes Ultimate] Using shortcode in another plugin

 *  Resolved [stipto](https://wordpress.org/support/users/stipto/)
 * (@stipto)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/plugin-shortcodes-ultimate-using-shortcode-in-another-plugin/)
 * Hey there,
 * I love this plugin! Love how the buttons work out. Really nicely done.
    Now, 
   I’m no php programmer so I must be doing something wrong here. I have a comparison
   plugin installed and would like to show the button from Shortcode Ultimate instead
   of the standard “Read the review” link. Now, in the php file of the comparison
   there is the following line, displaying the link:
 *     ```
       if (!($settings & MYRP_VC_REVIEW)) {
       		$return .= "<a href='" . get_permalink($post_id) . "' class='myrp_review_link'>" . myrp_i18n("Review") . "</a>";
       	}
       ```
   
 * Now I thought, if it spits out an \<a\> element, it could probably spit out a
   shortcode button. So I added it like this:
 *     ```
       if (!($settings & MYRP_VC_REVIEW)) {
        $return .= "[button link='" . get_permalink($post_id) . "' color="#0086bf" size="1" style="1" dark="0" square="0"]" . myrp_i18n("Review") . "[/button]";
       	}
       ```
   
 * But it doesn’t work. Anyone know how to do this ideally? Should I use the function
   instead of the shortcode?
 * Cheers!

Viewing 15 replies - 1 through 15 (of 15 total)

 *  [Vova](https://wordpress.org/support/users/gn_themes/)
 * (@gn_themes)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/plugin-shortcodes-ultimate-using-shortcode-in-another-plugin/#post-2044833)
 * Hi stipto!
 * Wrap you shortcode into special WordPress function do_shortcode()
 * In PHP code
 * before:
    $return = ‘[button link=”‘ . get_permalink( $post_id ) . ‘”] Hi there![/
   button]’;
 * after:
    $return = **do_shortcode(** ‘[button link=”‘ . get_permalink( $post_id).‘”]
   Hi there! [/button]’ **)**;
 *  [Vova](https://wordpress.org/support/users/gn_themes/)
 * (@gn_themes)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/plugin-shortcodes-ultimate-using-shortcode-in-another-plugin/#post-2044834)
 * Or just:
 * before:
 *     ```
       $return = '[button link="' . get_permalink( $post_id ) . '"] Hi there! [/button]';
       ```
   
 * after:
 *     ```
       $return = '[button link="' . get_permalink( $post_id ) . '"] Hi there! [/button]';
       do_shortcode( $return );
       ```
   
 *  Thread Starter [stipto](https://wordpress.org/support/users/stipto/)
 * (@stipto)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/plugin-shortcodes-ultimate-using-shortcode-in-another-plugin/#post-2044835)
 * Thanks!! Works like a charm!!
 *  [Vova](https://wordpress.org/support/users/gn_themes/)
 * (@gn_themes)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/plugin-shortcodes-ultimate-using-shortcode-in-another-plugin/#post-2044836)
 * Or =)
    you can use my native function
 *     ```
       gn_button_shortcode(
          array(
             'link' => 'http://example.com/',
             'color' => '#fc0'
          ), 'Button text'
       );
       ```
   
 * But I’m recommend you use a do_shortcode() function
 *  [Vova](https://wordpress.org/support/users/gn_themes/)
 * (@gn_themes)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/plugin-shortcodes-ultimate-using-shortcode-in-another-plugin/#post-2044837)
 * Not at all =)
 *  Thread Starter [stipto](https://wordpress.org/support/users/stipto/)
 * (@stipto)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/plugin-shortcodes-ultimate-using-shortcode-in-another-plugin/#post-2044844)
 * I’ve got one more! Here goes:
    Replace the following with a shortcode button:
 *     ```
       if ($visit_site != "") {
       		$return .= "<strong><a href='{$visit_site}'";
           	if (get_option("myrp_embed_visit_site_nofollow") == 1)
           	$return .= " rel='nofollow'";
           	if (($options & MYRP_VC_NEWWINDOW))
           	$return .= " target='_blank'";
         		$return .= " >{$link_text}</a></strong>";
          		}
       ```
   
 * This one’s difficult, because I think the variable $visit_site won’t work inside
   the shortcode.
 *  [Vova](https://wordpress.org/support/users/gn_themes/)
 * (@gn_themes)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/plugin-shortcodes-ultimate-using-shortcode-in-another-plugin/#post-2044846)
 * Try second method
 *     ```
       do_shortcode( $return );
       ```
   
 * if will not work, then i can’t help
 *  Thread Starter [stipto](https://wordpress.org/support/users/stipto/)
 * (@stipto)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/plugin-shortcodes-ultimate-using-shortcode-in-another-plugin/#post-2044856)
 * I’ve got it like this, but the variable doesn’t get read (probably I wrote wrong
   php):
 *     ```
       if ($visit_site != "") {
   
       $return = '[button link="'.$visit_site.'"] Hi there! [/button]';
       do_shortcode( $return );
   
          		}
       ```
   
 *  [Vova](https://wordpress.org/support/users/gn_themes/)
 * (@gn_themes)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/plugin-shortcodes-ultimate-using-shortcode-in-another-plugin/#post-2044858)
 * It’s right code, but you forget to print result =)
 *     ```
       if ( $visit_site ) {
       	$return = '[button link="' . $visit_site . '"] Hi there! [/button]';
       	echo do_shortcode( $return );
       }
       ```
   
 * Function do_shortcode() don’t print variable, it just processes them
 *  Thread Starter [stipto](https://wordpress.org/support/users/stipto/)
 * (@stipto)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/plugin-shortcodes-ultimate-using-shortcode-in-another-plugin/#post-2044859)
 * Great, thanks! The buttons get printed now except for the last one, and my whole
   layout is messed up. But I’m getting there 😉
 *  [Vova](https://wordpress.org/support/users/gn_themes/)
 * (@gn_themes)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/plugin-shortcodes-ultimate-using-shortcode-in-another-plugin/#post-2044889)
 * Don’t forget to share link to plugin =)
 *  Thread Starter [stipto](https://wordpress.org/support/users/stipto/)
 * (@stipto)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/plugin-shortcodes-ultimate-using-shortcode-in-another-plugin/#post-2044894)
 * What do you mean, to your plugin?
 *  [Vova](https://wordpress.org/support/users/gn_themes/)
 * (@gn_themes)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/plugin-shortcodes-ultimate-using-shortcode-in-another-plugin/#post-2044895)
 * It mean if you want to support author (me), share link to this plugin in twitter
   or any social network. Link – [http://ilovecode.ru/?p=122](http://ilovecode.ru/?p=122)
 * Thanks in advance =)
 *  Thread Starter [stipto](https://wordpress.org/support/users/stipto/)
 * (@stipto)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/plugin-shortcodes-ultimate-using-shortcode-in-another-plugin/#post-2044896)
 * Of course man! Thanks for the great work.
 *  [Vova](https://wordpress.org/support/users/gn_themes/)
 * (@gn_themes)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/plugin-shortcodes-ultimate-using-shortcode-in-another-plugin/#post-2044897)
 * Thanks for using it =)

Viewing 15 replies - 1 through 15 (of 15 total)

The topic ‘[Plugin: Shortcodes Ultimate] Using shortcode in another plugin’ is closed
to new replies.

## Tags

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

 * 15 replies
 * 2 participants
 * Last reply from: [Vova](https://wordpress.org/support/users/gn_themes/)
 * Last activity: [15 years, 2 months ago](https://wordpress.org/support/topic/plugin-shortcodes-ultimate-using-shortcode-in-another-plugin/#post-2044897)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
