Advertisement:

Author Topic: [TIP] Simple Social Share Buttons  (Read 27436 times)

volunteer

  • Full Member
  • ***
  • Posts: 241
[TIP] Simple Social Share Buttons
« on: April 05, 2014, 11:02:55 pm »
I have seen many pages using third party services like "sharethis" of "shareholic"

Is very simple and looks nice but it uses javascript and makes our websites more slow

Better to use plain html share buttons :) Here an example of what I use in my item.php

Code: [Select]
<!-- SHARE BUTTONS -->
<!-- Email -->
<a href="mailto:?Subject=EDIT THIS PART&Body=EDIT THIS PART <?php echo osc_item_url() ; ?>" target="_blank"><img src="/oc-content/themes/repurpose/images/email.png" alt="Share by email" title="Share by email" /></a>
<!-- Facebook -->
<a href="http://www.facebook.com/sharer.php?u=<?php echo osc_item_url() ; ?>" target="_blank"><img src="/oc-content/themes/repurpose/images/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>
<!-- Twitter -->
<a href="http://twitter.com/share?url=<?php echo osc_item_url() ; ?> <?php echo osc_item_title(); ?>" target="_blank"><img src="/oc-content/themes/repurpose/images/twitter.png" alt="Share on Twitter" title="Share on Twitter" /></a>
<!-- Google+ -->
<a href="https://plus.google.com/share?url=<?php echo osc_item_url() ; ?>" target="_blank"><img src="/oc-content/themes/repurpose/images/google.png" alt="Share on Google+" title="Share on Google+" /></a>
<!-- SHARE BUTTONS -->

PNG buttons attached

------------------------------------------------------------------------
UPDATE:

If you want to add a simple visual effect to the buttons you can use OPACITY in you CSS file by adding
Code: [Select]
#share-btn img{
opacity:1.0;
filter:alpha(opacity=100); /* For IE8 and earlier */
}
#share-btn:hover img{
opacity:0.5;
filter:alpha(opacity=50); /* For IE8 and earlier */
}

and apply the ID to the image like this id="share-btn"
Code: [Select]
<a href="http://www.facebook.com/sharer.php?u=http://yousite.com" target="_blank" id="share-btn">

now when you put the mouse over the buttons the opacity will go down by 50%
« Last Edit: May 10, 2014, 07:15:04 pm by volunteer »

frosticek

  • Hero Member
  • *****
  • Posts: 3948
Re: [TIP] Simple Social Share Buttons
« Reply #1 on: April 06, 2014, 12:29:31 pm »
@volunteer
What about Social Share Plugin? It do the same :)

volunteer

  • Full Member
  • ***
  • Posts: 241
Re: [TIP] Simple Social Share Buttons
« Reply #2 on: April 06, 2014, 01:18:09 pm »
social share plugin for fb and twitter works with javascript ? I think so.. anyway I don't like the buttons :P

Code: [Select]
        // twitter
        $content .= '<li class="twitter"><a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script></li>' ;
        // facebook
        $content .= '<li class="facebook"><div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><fb:like href="" send="false" layout="button_count" show_faces="false" font=""></fb:like></li>' ;
        // google plus
        $content .= '<li class="google-plus"><script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script><g:plusone size="medium"></g:plusone></li>' ;
        // pinterest
        $content .= '<li class="pinterest"><script type="text/javascript" src="//assets.pinterest.com/js/pinit.js"></script><a href="#" class="pin-it-button" count-layout="horizontal"><img border="0" src="//assets.pinterest.com/images/PinExt.png" title="Pin It" /></a></li>' ;
        $content .= '</ul>'
« Last Edit: April 06, 2014, 01:20:22 pm by volunteer »

frosticek

  • Hero Member
  • *****
  • Posts: 3948
Re: [TIP] Simple Social Share Buttons
« Reply #3 on: April 06, 2014, 07:15:46 pm »
@volunteer
Hah, everyone prefer own work :)

volunteer

  • Full Member
  • ***
  • Posts: 241
Re: [TIP] Simple Social Share Buttons
« Reply #4 on: April 06, 2014, 08:16:30 pm »
I am just trying to avoid javascript because I am already running quite a few in the site

frosticek

  • Hero Member
  • *****
  • Posts: 3948
Re: [TIP] Simple Social Share Buttons
« Reply #5 on: April 06, 2014, 09:29:43 pm »
@volunteer
Well, overloading site with javascript is not good, but osclass has very reduced javascript comparing to other popular scripts...

naneri

  • Newbie
  • *
  • Posts: 28
Re: [TIP] Simple Social Share Buttons
« Reply #6 on: April 21, 2014, 09:01:35 pm »
These social bookmarks are really awesome!!!

volunteer

  • Full Member
  • ***
  • Posts: 241
Re: [TIP] Simple Social Share Buttons
« Reply #7 on: May 10, 2014, 07:16:18 pm »
little update with visual effects

frosticek

  • Hero Member
  • *****
  • Posts: 3948
Re: [TIP] Simple Social Share Buttons
« Reply #8 on: May 11, 2014, 11:39:42 am »
@volunteer
Packing it into plugin with ability to select own icons and urls would be great ;)

volunteer

  • Full Member
  • ***
  • Posts: 241
Re: [TIP] Simple Social Share Buttons
« Reply #9 on: May 11, 2014, 02:43:31 pm »
Unfortunately my knowledge of PHP is zero  :-\
« Last Edit: June 08, 2014, 10:28:27 am by volunteer »

frosticek

  • Hero Member
  • *****
  • Posts: 3948
Re: [TIP] Simple Social Share Buttons
« Reply #10 on: May 11, 2014, 03:46:23 pm »
@volunteer
 :-[

Malefol7

  • Full Member
  • ***
  • Posts: 134
Re: [TIP] Simple Social Share Buttons
« Reply #11 on: June 08, 2014, 01:43:34 am »


This trick allows you to insert images of the buttons to your liking, the 'only thing that is missing is the counter. I'll post the link to see how it has been modified by me: Extraprezzo.it
« Last Edit: December 24, 2014, 11:53:24 pm by nazzario »

volunteer

  • Full Member
  • ***
  • Posts: 241
Re: [TIP] Simple Social Share Buttons
« Reply #12 on: June 08, 2014, 10:28:27 am »


This trick allows you to insert images of the buttons to your liking, the 'only thing that is missing is the counter. I'll post the link to see how it has been modified by me: annunci gratuiti
I don't understand what you are saying :) 
javascript has counters, the idea of this button is to keep it as simple as possible, basic html

ventado

  • Newbie
  • *
  • Posts: 13
Re: [TIP] Simple Social Share Buttons
« Reply #13 on: June 08, 2014, 01:17:16 pm »
Nice tut.  8)

Zacdaniel

  • Full Member
  • ***
  • Posts: 115
  • Why, Yes I'm a white african haha...
Re: [TIP] Simple Social Share Buttons
« Reply #14 on: November 12, 2014, 03:52:50 pm »
How would I integrated this into my site

Please take a look at my site
I have the plug in running
www.neckbreakerz.com/classifieds

Thanks