Support » Plugin: Scriptless Social Sharing » Suggestions for sidebar icons

  • I love the plugin, but what I’d really love is a way to re-use the same style and icons in a sidebar social links box.

    Something like https://wordpress.org/plugins/lightweight-social-icons/

    but using the already loaded svg icons and flexbox styling to save on loading another font (like the lightweight social icons one does

    As an example on a site I’m building I copied the html, changed the links, removed the mail and reddit icons and hacked in a new instagram link (working on getting a compatible svg) and here’s a result of what it looks like in my sidebar as compared to under the header image of a post

    https://imgur.com/a/iN7BD7a

    Would this be something you’d consider, or if not could you give a bit of advice on getting my hack working with an instagram svg?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Robin Cornett

    (@littlerchicken)

    You can output the sharing buttons anywhere with a bit of code. There is an example in the FAQ for adding the buttons to an archive page, but but you can change the hook to whatever is appropriate for your sidebar and use just the second function to add the buttons.

    Or you can use the shortcode to output the buttons in the sidebar, if you have a way to use shortcodes (I’m assuming this is a widgetized sidebar).

    As for adding another sharing button, I have an example of how to add a Facebook Messenger button which should be a good starting point; you would just have to provide your own icon. I’m curious, though, as last time I checked, Instagram did not have a sharing method/URL. Has that changed?

    Thread Starter outdoorsdev1

    (@outdoorsdev1)

    Thanks for the detailed reply!

    However – the aim of this is just a links box for people to go directly to my social media sites, not for sharing the site or article.

    It’s just to re-use the icons and styling and the would just be instagram.com/mysite, facebook.com/mysite e.t.c

    Plugin Author Robin Cornett

    (@littlerchicken)

    Oh, I understand now what you’re asking. At this point in time, I’m not planning to add personal sharing links as an option to the plugin, so your approach may be best for you.

    What I would suggest for the icons is to load your own, and use them as you like for your own markup and for the plugin output. It requires adding a filter to tell Scriptless where your icons are. For example, in my theme, I have a directory called sprites and then I have two sprite SVG files in it, brands.svg and solid.svg. I then use this code to tell Scriptless to use them instead of its own icons:

    
    add_filter( 'scriptlesssocialsharing_svg', 'prefix_prefer_theme_svg' );
    /**
     * Let's load completely custom icons which aren't somehow otherwise being loaded.
     * @param $args
     *
     * @return mixed
     */
    function prefix_prefer_theme_svg( $args ) {
    	$args['styles'] = array( 'brands', 'solid' );
    	$args['path']   = get_stylesheet_directory() . '/sprites';
    
    	return $args;
    }
    

    You can upload an SVG sprite file with whatever icons you need, including Instagram, and then use that.

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