Support » Plugin: My Favorites » Add shortcode to button

  • Resolved yannicksg

    (@yannicksg)


    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

    (@takashimatsuyama)

    Hello, @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://elementor.com/help/dynamic-shortcode-pro/

    Thread Starter yannicksg

    (@yannicksg)

    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

    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

    (@takashimatsuyama)

    Hi, @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

    (@yannicksg)

    Hello @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

    (@takashimatsuyama)

    Hi, @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 for usage.

    Thanks

    Thread Starter yannicksg

    (@yannicksg)

    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

    Musikleiste

    Plugin Author Takashi Matsuyama

    (@takashimatsuyama)

    Hi, @yannicksg

    I’m glad to hear that.
    Thank you, too.

    arslnser

    (@arslnser)

    I want to add to favourite button shortcode in my maxbutton plugin in my site http://kitchendimes.com I am using generatepress theme.

Viewing 8 replies - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.