Artiss Facebook Link



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

Description

Artiss Facebook link generates a link to Facebook allowing you to share post or page URLs.

It can be used in 2 different ways - a function call within your theme or a short code.

To use the function call (for example within a post loop) is as follows...

<?php if (function_exists('artiss_facebook_link')) : ?>
<a href="<?php artiss_facebook_link(); ?>">Share on Facebook</a>
<?php endif; ?>

Calling artiss_facebook_link will return the appropriate Facebook URL for the current post/page URL.

To use the shortcode you'd simple wrap [facebook] around any text that you wish to add the link to. For example...

[facebook]Share on Facebook[/facebook]

Further Parameters

The function call allows for 2 parameters to be specified.

The first parameter is a list of options relating to shortening the URL (this is then used by Facebook). Please see the next section, URL Shortening, for further details.

The second parameter is an optional URL, which you can use to override the default URL that will be shared. For example...

<?php artiss_facebook_link('','http://www.artiss.co.uk'); ?>

This will share the URL http://www.artiss.co.uk on Facebook.

The same can be done with the short code, using the URL parameter. For example...

[facebook url="http://www.artiss.co.uk"]Share on Facebook[/facebook]

URL Shortening

To shorten URLs you must install the Simple URL Shortener plugin.

Once active, you can use the first parameter of Artiss Facebook Link to request the URL to be shortened. The following parameters are valid...

service= : This is the name of the shortening service

apikey=, login=, password=, cache : These allow optional URL shortening options to be specified (see the documentation for Simple URL Shortener for further details)

These specified with a seperating ampersand, for example...

<?php artiss_facebook_link('service=is.gd&cache=no','http://www.artiss.co.uk'); ?>

The same parameter can be used with the short code. For instance...

[facebook url="http://www.artiss.co.uk" service="is.gd" cache="no"]Share on Facebook[/facebook]

Do you need to shorten URLs for Facebook? Personally I don't, as when trying to share the URL Facebook will attempt to retrieve titles, thumbnails, etc, and may struggle if the URL has been shortened. But, the option is there if you do wish to.

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.

Changelog

1.0

  • Initial release

1.1

  • Added bit.ly to list of URL shortening services

1.2

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

1.3

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

1.4

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

1.5

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

Mantis Bug Tracker

Known Bugs

No bugs are currently recorded.

Planned Enhancements

No enhancements are currently planned.

Delicious Digg Facebook LinkedIn Read It Later reddit StumbleUpon Twitter SeparatorEmail Google Translate PDF Online Print Friendly

Support Forum

Please use the forum for reporting any problems, queries or suggestions relating to this plugin.

25 Comments - ARCHIVE

  1. Ian says:

    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.

    • David says:

      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 says:

    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,

    :)

    • David says:

      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 says:

    Thx David !

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

    How i can to do it ?

    Thx ! :)

    • David says:

      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 says:

    Thanks a lot David !

    I go to try this !

    :)

  5. baron says:

    Works great, thank you

  6. Jeff says:

    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.

    • David says:

      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. Iman says:

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

    • David says:

      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. Iman says:

    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.

    • David says:

      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. Iman says:

    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. David says:

    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 says:

    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

    • David says:

      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. Dave says:

    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. Daniel says:

    Hi David,

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

    • David says:

      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. Alan says:

    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.

  15. Eric says:

    Hi,

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

    Where in the loop code should I put it?

    • David says:

      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.

2 Pingbacks/Trackbacks

  1. Top 1000 WordPress Plugins | Coramen`s Blog wrote:

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