Title: Add shortcode to button
Last modified: August 6, 2021

---

# Add shortcode to button

 *  Resolved [yannicksg](https://wordpress.org/support/users/yannicksg/)
 * (@yannicksg)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/add-shortcode-to-button-3/)
 * Is it possible to use the “add favorite” shortcode in a button?
 * I use Elementor and tried adding the shortcode with and without style, without
   any success.

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

 *  Plugin Author [Takashi Matsuyama](https://wordpress.org/support/users/takashimatsuyama/)
 * (@takashimatsuyama)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/add-shortcode-to-button-3/#post-14740946)
 * Hello, [@yannicksg](https://wordpress.org/support/users/yannicksg/)
 * Sorry. I’ve never used Elementor, so I don’t know about compatibility, but can
   shortcodes be used in that plugin?
 * **URLs that may be relevant**
    [https://wordpress.org/support/topic/shortcodes-and-elementor-2/](https://wordpress.org/support/topic/shortcodes-and-elementor-2/)
   [https://elementor.com/help/dynamic-shortcode-pro/](https://elementor.com/help/dynamic-shortcode-pro/)
 *  Thread Starter [yannicksg](https://wordpress.org/support/users/yannicksg/)
 * (@yannicksg)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/add-shortcode-to-button-3/#post-14741057)
 * Thanks for the quick reply!
 * Yes, shortcodes can be used in a button. But the button recognizes the shortcode
   as a link: [https://www.loom.com/share/18b7f3f4685f4e4ab3c38d619127330c](https://www.loom.com/share/18b7f3f4685f4e4ab3c38d619127330c)
 * Another quick question, is it possible to use a WordPress Function in the shortcode,
   so we don´t have to add each page id manually?
 *  Plugin Author [Takashi Matsuyama](https://wordpress.org/support/users/takashimatsuyama/)
 * (@takashimatsuyama)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/add-shortcode-to-button-3/#post-14741258)
 * Hi, [@yannicksg](https://wordpress.org/support/users/yannicksg/)
 * Yes, you can use WordPress functions for the shortcode. You can set the post 
   ID dynamically.
    However, I don’t know if you can do that in Elementor.
    1. Can you try to put just the shortcode in an empty block?
    2. Or does it work if I enter it in a regular block editor shortcode block?
 * Also, the `style=''` would probably be the default style.
    If you don’t want 
   the default style, put some name like `style='none'`.
 *  Thread Starter [yannicksg](https://wordpress.org/support/users/yannicksg/)
 * (@yannicksg)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/add-shortcode-to-button-3/#post-14747263)
 * Hello [@takashimatsuyama](https://wordpress.org/support/users/takashimatsuyama/),
 * the shortcode works with a simple shortcode block from Elementor, yes. I think
   it is an issue with Elementor, that they are trying to open Shortcodes as a link,
   when you add them to a button.
 * I also managed to add the Post ID dynamically and and to the Sonaar Music Player.
   Thank you!
 * One last question, is there a list of style codes I can work with? I try to have
   the preview images in 400×400 size.
 *  Plugin Author [Takashi Matsuyama](https://wordpress.org/support/users/takashimatsuyama/)
 * (@takashimatsuyama)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/add-shortcode-to-button-3/#post-14747739)
 * Hi, [@yannicksg](https://wordpress.org/support/users/yannicksg/)
 * Thank you for your review.
 * There are two styles: default or write your own.
 * **Modify the default style**
    shortcode: `[ccc_my_favorite_list_results]`
 *     ```
       #ccc-my_favorite-list[data-ccc_my_favorites-list-style="1"] .list-ccc_favorite {
           width: 400px;
       }
       #ccc-my_favorite-list[data-ccc_my_favorites-list-style="1"] .list-ccc_favorite .img-post-thumbnail {
           padding-bottom: 100%;
       }
       ```
   
 * **Style your own**
    shortcode: `[ccc_my_favorite_list_results style="your_style_name"]`
 *     ```
       #ccc-my_favorite-list[data-ccc_my_favorites-list-style="your_style_name"] {
        ...
       }
       ```
   
 * Please, try it.
 * Also, you can customize the list view.
 * shortcode: `[ccc_my_favorite_list_custom_template]`
 * Please see [the related topic](https://wordpress.org/support/topic/template-59/)
   for usage.
 * Thanks
 *  Thread Starter [yannicksg](https://wordpress.org/support/users/yannicksg/)
 * (@yannicksg)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/add-shortcode-to-button-3/#post-14747770)
 * Thank you, I still need to learn a lot more about PHP, but I changed the padding–
   bottom and deleted text and now everything is as we wanted:
 * [⌊Favoriten⌉⌊Favoriten⌉[
 * [⌊Musikleiste⌉⌊Musikleiste⌉[
 *  Plugin Author [Takashi Matsuyama](https://wordpress.org/support/users/takashimatsuyama/)
 * (@takashimatsuyama)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/add-shortcode-to-button-3/#post-14747815)
 * Hi, [@yannicksg](https://wordpress.org/support/users/yannicksg/)
 * I’m glad to hear that.
    Thank you, too.
 *  [arslnser](https://wordpress.org/support/users/arslnser/)
 * (@arslnser)
 * [4 years, 5 months ago](https://wordpress.org/support/topic/add-shortcode-to-button-3/#post-15189945)
 * I want to add to favourite button shortcode in my maxbutton plugin in my site
   [http://kitchendimes.com](http://kitchendimes.com) I am using generatepress theme.

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

The topic ‘Add shortcode to button’ is closed to new replies.

 * ![](https://ps.w.org/my-favorites/assets/icon.svg?rev=2459439)
 * [My Favorites](https://wordpress.org/plugins/my-favorites/)
 * [Support Threads](https://wordpress.org/support/plugin/my-favorites/)
 * [Active Topics](https://wordpress.org/support/plugin/my-favorites/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/my-favorites/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/my-favorites/reviews/)

 * 8 replies
 * 3 participants
 * Last reply from: [arslnser](https://wordpress.org/support/users/arslnser/)
 * Last activity: [4 years, 5 months ago](https://wordpress.org/support/topic/add-shortcode-to-button-3/#post-15189945)
 * Status: resolved