Support » Plugin: Lightweight Social Icons » HELP using “Widget shortcode” to place “Lightweight Social Icons” arbitrarily

  • Resolved xarelix

    (@xarelix)


    My site has zero sidebars, I am trying to place the the “Lightweight Social Icons” onto my woocommerce product pages.

    I only just realized that without sidebars there is no way to use a widget, which is a requirement for using “Lightweight Social Icons”

    I am wanting to add the social icons to each product to the right of the add to cart button, or if that dont work then below the “add to cart”/SKU/Category stuff, theres plenty of space there for it too.

    https://i.imgur.com/ks3yiqq.png

    I can see that Tom suggests “Widget shortcode” addon which I have installed, but I do not understand how to use it.

    I read through all 5 pages posts, I see that one guy from 3 years ago was able to do it with a little help from Tom: https://wordpress.org/support/topic/icons-on-homepage/

    • This topic was modified 1 year, 5 months ago by xarelix.
    • This topic was modified 1 year, 5 months ago by xarelix. Reason: typos
Viewing 4 replies - 1 through 4 (of 4 total)
  • I think I understand a little bit more.

    so you goto Appearance > Widgets.

    next drag the “Lightweight Social Icons” to the “Widget Shortcode” section

    The last step is to figure out how and where to place the code that makes it show up, I am tinkering with this now, hoping I can maybe do it with the “code snippets” plugin.

    edit: ahhh I see the shortcode is:
    [widget id=”lsi_widget-2″]

    so now I just need to modify the below so that it shows up on the product page where I want it:

    <?php echo do_shortcode(‘[widget id=”lsi_widget-2″ title=”Share”]’); ?>

    I think this is probably where I will get stuck the most, I am hoping to use code snippets to load the code, but not sure what needs to be changed with the above code so that it loads it on the product pages.

    • This reply was modified 1 year, 5 months ago by xarelix. Reason: more info
    • This reply was modified 1 year, 5 months ago by xarelix.

    I just wanted to post that I solved this:

    function addSocials() {
    	echo '<div class="dsocial">';
    	echo do_shortcode('[widget id="lsi_widget-2"]');
    	echo '</div>';
    }
    add_action( 'woocommerce_after_add_to_cart_button', 'addSocials' );

    SOURCE: https://businessbloomer.com/woocommerce-visual-hook-guide-single-product-page/

    When I did the above it appeared to work, but the div was making the “add to cart” button unclickable, instead I did this:

    function addSocials() {
    	echo do_shortcode('[widget id="lsi_widget-2"]');
    }
    add_action( 'woocommerce_after_add_to_cart_button', 'addSocials' );

    and then in additional css I added this:

    .button.single_add_to_cart_button.button.alt{
    	margin-right: 20px;
    }
    • This reply was modified 1 year, 5 months ago by xarelix. Reason: cleanup
    Plugin Author Tom

    (@edge22)

    Thanks for sharing your solution! 🙂

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘HELP using “Widget shortcode” to place “Lightweight Social Icons” arbitrarily’ is closed to new replies.