• >>Sara<<

    (@tommasopiccarreda)


    Hey there I’m here to ask your support for an Hamletic doubt:

    I’m using a plugin (Monarch) to show social buttons for share a page. The plugin allows me to positioning these buttons in several places but none of these places is good for my theme.

    See the screenshot:
    https://www.shinypixel.eu/upload/plugin-position.jpg

    Unfortunately the plugin do not provide any shortcode for positioning the buttons in custom places.

    There’s a way to move these button where I want maybe building another plugin that provide a shortcode? Is it science fiction?

    Thanx for ur time!

Viewing 10 replies - 1 through 10 (of 10 total)
  • Definitely not science fiction, it’d be a lot of work to build yourself… but are you sure Monarch doesn’t provide one? ??

    https://www.elegantthemes.com/plugins/monarch/documentation/shortcode/

    If you want to have more granular control over the styling of the buttons once you get them into your code, do some custom CSS beyond that.

    Thread Starter >>Sara<<

    (@tommasopiccarreda)

    Well yes Monarch provide two set of buttons, share and follow for obvious reasons. The problem is that the shortcodes only controls follow buttons, but I need them for share the post.. :/

    Moderator bcworkz

    (@bcworkz)

    Disclaimer: I don’t know anything about the Monarch plugin, my comments are speaking in general terms, specific details unknown to me may interfere with this working.

    Wrap the shortcode in external divs and position that container instead of the buttons within:

    <div style="position: absolute; top: 100px; left: 250px;">
      [your-shortcode]
    </div>

    Note that using style attributes is considered really bad form, you should really assign a class or ID and style that with the rest of your CSS. Style attributes will override any other CSS normally applied, which is why it is bad form and so powerful at the same time.

    Additionally, absolute positioning is unlikely to work for you, but illustrates the outside container concept well. Use your browser’s developer tools to try different rules to see what will actually work for you.

    This is probably similar to what Tyler was suggesting with “custom CSS”, I’m just expanding upon that suggestion.

    Got it, those shortcodes display follow links, not share links.

    I don’t think they provide a shortcode for that, the inline options will get you close – but you may need to use CSS to hook onto the inline code and move it to where you want, similar to how bcworkz suggested but purely using CSS to find monarch-specific ID’s or Classes.

    https://www.elegantthemes.com/plugins/monarch/documentation/inline/

    Could you provide a link to your site along with a description of where you’d ideally want the social-share links placed? Someone in the community might be able to help you with the CSS. Make sure that you’re using inline (or at the very least the option that’s closest to what you want) and that the sharing code is operational and visible on your page, that way I or someone else in the community can manipulate the CSS in our browsers.

    You might also be able to dissect the plugin and make a call to Monarch from within your theme files under (condition that the plugin is installed) inside of a child theme, but it might be best to avoid custom PHP solutions / extending your theme unless you absolutely have to.

    As an aside, I’d make a guess that they intentionally left out this functionality. There’ll only be certain locations in the code where sharing code will work properly. This is why a CSS fix might be your best bet.

    Thread Starter >>Sara<<

    (@tommasopiccarreda)

    Hey guys thanks a lot for your advices and suggestions.

    CSS was really my last-resort cause my theme is responsive. Playing around with PHP instead I found solution that is it very effective for me. Since that the plugin already uses a shortcode to call the “follow button” I mobbed the monarch.php file, copying that function and editing it to my purpose to call the “share buttons” with a custom shortcode:

    Under this code that create a shortcode for “follow btn”

    add_shortcode( 'et_social_follow', array( $this, 'display_shortcode' ) );

    I placed this:

    add_shortcode( 'et_social_share', array( $this, 'display_mine' ) );

    then I added the function related:

    function display_mine() {
    $monarch_options = $this->monarch_options;
    return $this->generate_inline_icons( 'et_social_inline_top' );
    }

    ..and works great!
    Hope someone can take benefit from this. Thanks again!

    Glad to hear!

    Just clarifying: your site is responsive because of CSS, PHP has nothing to do with it. I personally wouldn’t have advocated for the use of position: absolute which may have easily broke your responsive features.

    Otherwise I think you did the right thing by using PHP, but be careful because if you edited plugin or theme files directly, you’ll lose your customizations if you run updates

    Sara, thanks for posting this up.

    Your solution worked perfectly. I’ll just have to update manually when Monarch has an update until they provide a native shortcode solution.

    @tommasopiccarreda

    THANK YOU! Your solution was perfect. I feel silly for not thinking of it myself! Amazed that ET haven’t implemented this already.

    Thanks again!

    • This reply was modified 8 years, 2 months ago by Chee Studio.

    Hi, thanks for this topic.

    What short code you added to your topic to call the line of icons? I’ve tried with <? Php if (function_exists (‘et_social_share’)) {et_social_share (); }?> It does not work ??

    Thank you.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Call a plugin with a shortcode’ is closed to new replies.