Artiss Social Share

Artiss Social Share (formally Artiss Facebook Link and Simple Twitter Link) will generate a URL that allows you to quickly and easily share a post or page on Facebook, Twitter or Google+.

Description

Artiss Social Share is an easy way to generate a link to Facebook, Twitter or Google+, allowing you to share post or page URLs.

Features include...

  • Fully XHTML compliant output
  • Use a PHP function call in your theme or a shortcode in your post or page
  • Twitter URLs can be shortened using Artiss URL Shortener plugin - choose from over 100 shortening services
  • Grabs the current URL and title - or override them to your own if you wish
  • Using the shortcode you can add a sharing link directly in the middle of a post
  • Automatic caching ensures minimal performance impact!

The simplest way to use this plugin is with one of the 3 shortcodes - [facebook], [google] or [twitter]. Simply wrap these around a piece of text to link to the social site of choice.

For example...

[facebook]Share on Facebook[/facebook]

This would generate link to Facebook, sharing the current page.

Facebook Share

To use the function call (for example within a post loop) you would do the following...

<a href="<?php artiss_facebook_link(); ?>">Share on Facebook</a>

This will return a URL to allow the current post/page URL and title to be shared on Facebook.

Three, optional, parameters can be specified - the first one is now redundant, the second is a replacement URL and third is a title. For example...

<a href="<?php artiss_facebook_link( '', 'http://www.artiss.co.uk', 'Welcome to Artiss.co.uk' ); ?>">Share on Facebook</a>

The shortcode, [facebook], has 4 optional parameters...

  • url - If you wish to override the URL
  • title - If you wish to override the title
  • target - The link target
  • rel - The link rel

For example...

[facebook url="http://www.artiss.co.uk" title="Welcome to Artiss.co.uk" rel="nofollow" target="_new"]Share on Facebook[/facebook]

Google+ Share

To use the function call (for example within a post loop) you would do the following...

<a href="<?php artiss_google_link(); ?>">Share on Google+</a>

This will return a URL to allow the current post/page URL and title to be shared on Google+.

An optional parameter can be specified - a replacement URL. For example...

<a href="<?php artiss_google_link( 'http://www.artiss.co.uk' ); ?>">Share on Google+</a>

The shortcode, [google], has 3 optional parameters...

  • url - If you wish to override the URL
  • target - The link target
  • rel - The link rel

For example...

[google url="http://www.artiss.co.uk" rel="nofollow" target="_new"]Share on Google+[/google]

Twitter Share

To use the function call (for example within a post loop) you would do the following...

<a href="<?php artiss_twitter_link(); ?>">Share on Twitter</a>

This will return a URL to allow the current post/page URL and title to be shared on Facebook with a default status.

Four, optional, parameters can be specified. These are...

  • The Twitter status message - see below for details
  • Your own URL, if you don't wish the current one to be used
  • A list of options - see below for more information
  • Your own title, if you don't wish the current one to be used

The Twitter status message can contain a number of tags - %url%, %title% and the shortening service that you wish to use (see the next section for further details). These will be replaced with the appropriate text before the status message is sent to Twitter.

For example...

<a href="<?php artiss_twitter_link( '%tinyurl%Currently reading a blog post called "%title%" - %url%', 'http://www.artiss.co.uk', '', 'Welcome to Artiss.co.uk' ); ?>">Share on Twitter</a>

The 1st parameter is the Twitter status - %title% and %url% will be replaced, as appropriate. %tinyurl% indicates the URL shortening service to be used and will be omitted in the resulting status.

The 3rd parameter, as mentioned above, is a list of options mainly relating to URL shortening. Each of these are seperated by an ampersand and are all optional...

  • cache= - How long to cache the output, in hours. The default is 24. Specify as No to not cache at all
  • apikey= - Enables you to pass an API key (if required) to the URL shortening service - see Artiss URL Shortener notes for details
  • login= - Enables you to pass a login (if required) to the URL shortening service - see Artiss URL Shortener notes for details
  • password= - Enables you to pass an password (if required) to the URL shortening service - see Artiss URL Shortener notes for details

For example...

<a href="<?php artiss_twitter_link( '%tinyurl%Currently reading a blog post called "%title%" - %url%', 'http://www.artiss.co.uk', 'cache=4&login=test', 'Welcome to Artiss.co.uk' ); ?>">Share on Twitter</a>

This overrides the caching to 4 hours and passes a login of test to the URL shortening service of tinyurl.

The shortcode, [twitter], has 9 optional parameters...

  • url - If you wish to override the URL
  • title - If you wish to override the title
  • target - The link target
  • rel - The link rel
  • text - The status text. Use the tags, as specified above
  • cache - How long to cache the output, in hours. The default is 24. Specify as No to not cache at all
  • apikey - Enables you to pass an API key (if required) to the URL shortening service - see Artiss URL Shortener notes for details
  • login - Enables you to pass a login (if required) to the URL shortening service - see Artiss URL Shortener notes for details
  • password - Enables you to pass an password (if required) to the URL shortening service - see Artiss URL Shortener notes for details

For example...

[twitter text="%tinyurl%Currently reading a blog post called %title% - %url%" url="http://www.artiss.co.uk" title="Welcome to Artiss.co.uk" rel="nofollow" target="_new" cache="4"]Share on Twitter[/twitter]

Licence

This WordPress plugin is licensed under the GPLv2 (or later).

Installation

  1. Upload the entire simple-facebook-link folder to your wp-content/plugins/ directory.
  2. Activate the plugin through the 'Plugins' menu in WordPress.
  3. That's it, you're done - you just need to add the function call or short code!

Frequently Asked Questions

Which version of PHP does this plugin work with?

It has been tested and been found valid from PHP 4 upwards.

Please note, however, that the minimum for WordPress is now PHP 5.2.4. Even though this plugin supports a lower version, I am not coding specifically to achieve this - therefore this minimum may change in the future.

I'm using a previous version of the plugin (or one of those that was merged into it). Will it still work?

I maintain backwards compatibility, so it should - if not, let me know and I'll get it fixed.

Changelog

2.1

  • Bug: No longer have to specify all the parameters for the artiss_twitter_link function
  • Bug: Fixed issue with conversion of characters in titles
  • Enhancement: Added basic Google Analytics tracking

2.0

  • Maintenance: Renamed to Artiss Social Links
  • Maintenance: Further improvements to code
  • Maintenance: Removed URL shortening from Facebook
  • Enhancement: Merged Simple Twitter Link
  • Enhancement: Added Google+ sharing
  • Enhancement: Added new title parameter, allowing the title to be overridden for Facebook and Twitter shares
  • Enhancement: Added caching to Twitter share

1.5

  • Maintenance: Plugin renamed as part of new naming policy
  • Maintenance: Function name changed to match - old function name still usable
  • Maintenance: Updated code to new standards, including addition of PHPDoc
  • Maintenance: Re-written instructions
  • Enhancement: Added shortcode option

1.4

  • Enhancement: Added ability to send API keys, etc, when requesting shortened URLs

1.3

  • Maintenance: Code tidied
  • Enhancement: Now using Artiss URL Shortener plugin to provide URL shortening
  • Enhancement: Added new parameter that allows overriding of passed URL
  • Enhancement: Blog title again corrected, using code from Simple Social Bookmarks plugin

1.2

  • Bug: Fixed issue with ampersands (and probably other characters) in the blog title causing linking issues
  • Enhancement: Added su.pr as another URL shortening service

1.1

  • Enhancement: Added bit.ly to list of URL shortening services

1.0

  • Initial release
[mantis]Artiss Social Share[/mantis]
Loading Facebook Comments ...

27 Thoughts on “Artiss Social Share

  1. I read the instructions but I’m not entirely clear on how to implement this. The plugin is activated, but if I paste <a href=”">Share on Facebook onto the end of my post nothing show up. Where am I suppesed to add this code?

    i.e. I don’t know what this means: The code for Simple Facebook Link should be added to the bottom of appropriate post/page templates within your theme (and in the case of posts, within the loop).

    thanks.

    • Hi, thanks for the comment. Sorry to hear you’re having problems.

      If you don’t know how to add code to “the loop” then it can be quite difficult to explain. Here’s the WordPress page on it – http://codex.wordpress.org/The_Loop. The code for this plugin needs to be added somewhere within “the loop” but where is up to you – it depends where you want this to display. You will have “the loop” within any page or post code you have within your theme – this will include index.php, single.php and page.php.

      If all else fails, contact me via my form and attach the code of the page that you’re attempting to add the code to. I’ll show you exactly where the code goes and try and give you a better explanation of why.

  2. MoiMM on May 24, 2009 at 10:04 am said:

    Hello !

    I’m French, sorry for my bad english ! :)

    Thanks for your nice plugin !

    I want to know how i can open the facebook window in a new little window !?

    (i want the same thing that on the Youtube page for exemple !)

    Thanks

    Regards,

    :)

    • You need to add a simple TARGET to the link.

      So here’s the example with the TARGET added…

      <a href="<?php simple_facebook_link(''); ?>" target="_blank">
      Share on Facebook</a>
  3. MoiMM on May 29, 2009 at 9:57 am said:

    Thx David !

    But i want open a new window in this format > 620x440px !

    How i can to do it ?

    Thx ! :)

    • In this case you’ll need to use JavaScript.

      The following should work (although I’ve not tested it)…

      <a href="" onClick="window.open('<?php simple_facebook_link(''); ?>',
      'Share on Facebook','width=620,height=440')">Share on Facebook</a>

      More details about how to do this can be found here (or, in fact, Google “open window with JavaScript”…

      http://www.pageresource.com/jscript/jwinopen.htm

  4. MoiMM on May 29, 2009 at 2:28 pm said:

    Thanks a lot David !

    I go to try this !

    :)

  5. baron on June 23, 2009 at 7:21 pm said:

    Works great, thank you

  6. You have a section at the top left of the page that says “Find Me Online” with all the different places you have profiles. What WordPress plugin is that? I presume that is functionally different than say Add to Any.

    • Hi Jeff, that’s a plugin of my own. However, I’ve never made it available to the public as I’ve pretty much hardcoded the links for myself. I’m currently working on a social sharing plugin for post entries, so this may be a natural progression for me – to launch this plugin “properly”!

  7. Nice plugin, but not show Facebook Image, only Text link, Too Bad. Can you make this plugin show Facebook Image before the Text link.

    • Iman, the text is not part of the plugin. All the plugin does is return a link – it’s completely up to you whether you assign this link to some text or an image. There are many Facebook icons to be found on the ‘net, so simply grab one of those and wrap the plugin around a link to that.

  8. I think you plugin miss spelling, below I paste the link code froum your Plugin… http://www.facebook.com/sharer.php?u=http://hariansib.com/? See you make sharer not share, this make wrong function with some case.

    • Iman, that link works fine for me. Although producing slightly different screens, both share.php and sharer.php should work – sharer.php is the one that Facebook uses in its examples, and hence why I’ve used it.

      Are you saying that this link does NOT work but does if you replace it with share.php?

  9. Links Works, But Cancel button didnt work well, the windows still open after we push the Cancel Button. Now I have replaced the shares with share, and Cancel button did work well now.

  10. You’re right Iman. It appears that the share page has kept step with recent Facebook changes but sharer hasn’t. I’m looking at a change in the code anyway, so may possibly implement a change to sharer.

  11. Einar Helland Berger on July 15, 2009 at 3:11 pm said:

    First of all, thanks for this wonderful plugin. I am going to use it on the new version of my norwegian website about waterpolo, http://www.vannpolo.org.

    However, when I validated my site after activating your plugin the Facebook link caused a validation error. This is because of the ampersand in the URL. I fixed it easily by changing “&” to “&”, which W3C recommends, on line 32.

    Can you please implement this change in your plugin, so I don’t have to do this manually for every update?

    Einar

    • Hi Einar, thanks for the comments.

      Yes, you’re right about the validation. It’s my intention in the next few weeks to go through all my plugins and give them a good “spring clean” – ensuring validation is one thing I’ll be doing. I’ve had a number of suggestions recently about various plugins that will be useful to implement with others too, so these are the kinds of things I’ll be doing.

  12. Thanks David for a simple plugin. It is so cool and I had no problem installing it especially considering I just started using WordPress for my new Travelogue.

    http://graystarcity.info/

  13. Hi David,

    What’s the “Find Me Online” widget at the top of your page? It’s Brilliant.

    • I get asked this a lot.

      However, although it is a plugin of my own, it’s not a “proper” released one, as it has my links hard-coded into it. For this to be viable I’d have to put an admin screen, etc, in it.

      But, if anybody wants the plugin to modify themselves with their own site links, then let me know and I’ll happily email it to you.

  14. Pingback: Top 1000 WordPress Plugin Authors « Metode de promovare

  15. This works in my homepage posts where it appears in all the posts. but if i click on one of the post titles, the “Share on Facebook” is gone…

    How can I include it? Thanks.

  16. Hi,

    I want to put SFL at the end of every post.

    Where in the loop code should I put it?

    • The beginning of the loop is probably the line <?php while (have_posts()) : the_post(); ?> and the loop will probably be an endwhile statement sometime later. Placed the code before the endwhile and it should appear as the last thing in the post.

  17. Pingback: Top 1000 WordPress Plugins | Coramen`s Blog

2 Pings/Trackbacks for "Artiss Social Share"
  1. Top 1000 WordPress Plugins | Coramen`s Blog says:

    [...] Simple Facebook Link [...]

Top
%d bloggers like this: