Crea sito

WordPress Social Ring 1.1: template tag and social widget

After the official launch three months ago and some minor releases to adjust previous bugs, the first major named 1.1 has  finally come. This new version adds two new functions: a template tag and a widget.

Template Tag social_ring_show()

This function allows webmasters to place social buttons in their favourite position. This function must be used inside the loop, otherwise it will not be working properly.

In order to recover it you can use the following code (the if statement on function existance avoids errors in case of deactivation)

<?php if(function_exists('social_ring_show')){ social_ring_show();} ?>

This function is very useful expecially to exceed the limits of the visualisation before or after the content. By working directly on the theme you can now place buttons before the title or between the title and date etc.

You can also use it with themes that show only the excerpt of the post on archives and home. In this case the old plugin was not usable, while with the new one you can recall the template tag before the excerpt function.

Social Ring Widget

This is a widget to add social buttons on sidebars. Its goal is to promote the home page, in fact the shared address is the same on all pages. You can see social Ring Widget in action here on the sidebar on the right.

The widget has some options, let’s see them:

WordPress Social Ring Widget

  1. Widget Title: is the title above the widget.
  2. URL: is the address shared on social networks. It’s the same on all pages and its default value is the home page of the blog. If you insert your Fan Page address as Facebook Like URL, people who click on it become fans.
  3. Twitter: Besides the URL, you can insert text and account (“via @account”) which will appear in the Tweet. You can also recommend a Twitter accounts for users to follow after they share content from your website.
  4. Style: widget graphic is not so much customizable. You can change only button distance, widget padding and border colour.

The minimum width required for the sidebar to show the widget properly is 200px. Default values for button margin and widget padding are optimized for a 300px sidebar. If your theme has a smaller one, you can reduce those values to adapt Social Ring widget to it.

If you find any bug you can report it in the comments, I’ll fix it as soon as possible. These are the features that will be added in next versions:

  • Shortcode to add buttons inside posts.
  • CSS editing by admin page.
  • Twitter settings.
  • Flattr and linkedin.

For any suggestion write me.

 

 

 

  • Jordan

    Hi,

    First off thanks for creating such a good plugin, i’ve just installed in on my blog and love the ease of use and simple functionality, i’ve tried other social plugins but so far yours seems to be the best for me.

    I was wondering if you’d be able to help me with something within the plugin though and whether I would be able to do this easily. What it is I want to do is so that when someone clicks the “tweet” button on a post i would like it to tag my twitter account in it (@JordanILGM) hope you can help me with this, if you could email me i would very much appreciate it, thanks!

    • http://wordpress.altervista.org/ Niccolò Tapparo

      Actually there’s no way to do it, but that’s one of the features I’m working on. I’ll add on the admin page a section called “twitter settings” where you can insert the account to mention and a follow suggestion.

      • Jordan

        Ok cool, look forward to it, thankyou!

  • http://www.organicbabyatlanta.com Lisa

    The facebook like box suddenly disappeared from my posts today. This is really bugging me because I am using one of my posts as a sample for something I’m applying for, and one of my big selling points was the number of likes that post had, which was of course displayed on the post. Now it’s gone! It was there this morning. What happened? I didn’t change anything. I tried unchecking the “facebook like” box and rechecking it, but it’s simply not appearing after my posts.

    • http://wordpress.altervista.org/ Niccolò Tapparo

      Hi Lisa, at this moment I see the like button on your posts. Maybe it was a temporary issue of facebook.

  • http://jon.than.io Jonathan Wright

    In the function social_ring_print_check() I added the following lines:

    $do_disable = get_post_custom_values(‘disable_social_share’);
    if ($do_disable[0] == ‘yes’) {
    return 0;
    }

    which matches allowed the use of a custom field within individual pages and posts to switch off the sharing just for those pages.

  • http://www.photographysellingsystem.com/ matt

    I am trying to figure out how to remove the code from one of 2 pages of the entire site. I noticed the comment by @Jonathan Write back on the 8th but I have had a real issue getting that to work for me. can you give any help or give me a quick way for me to tun off the social stuff on a what will be my thank you page for my cart?

    • http://jon.than.io/ Jonathan Wright

      Matt,

      There’s two parts to this:

      1. Edit your wp-content/plugins/wordpress-social-ring/includes/library.php file and just before line 212 (assuming you’re running the most recent version as I write this) add the code:

      $do_disable = get_post_custom_values(‘disable_social_share’);
      if ($do_disable[0] == ‘yes’) {
      return 0;
      }

      2. Install the module ‘Advanced Custom Fields’. Once installed, click on ‘Custom Fields’ in the menu bar. Click ‘Add New’ next to the title on the next page. On the next page, enter a title (e.g. ‘Disable Social Media Plugin’) then click ‘Add Field’.

      Field Label: Disable Social Share
      Field Name: disable_social_share
      Field Instructions: Select Yes to disable the showing of the Social Share widget at the bottom of the text on this page.
      Field Type: Radio Button
      Required: No
      Choices:

      yes : Yes
      no : No

      Default Value: no
      Layout: Horizontal

      If you want to control where the option appears, use the rules below. I’ve mine set to

      ‘Post Type’ ‘is equal to’ ‘Post’
      ‘Post Type’ ‘is equal to’ ‘Page’

      match ‘any’ of the above.

      Then Position: Side

      Click ‘Update’ to the right and you should be done. Goto the page you want to disable it on, and in the top-right you should have a box called ‘Disable Social Share’ and an option with ‘yes’ and ‘no’ (with ‘no’ selected) – click ‘yes’, ‘Update’ and when you goto the page, hopefully it won’t appear!

  • http://melloware.com Melloware

    On my website I have added your Social Ring but somehow the CSS styling is messed up and the Google Plus hover as well as the Facebook counts are not appearing. You can check out my website at @ melloware com and on our Products pages you will see the social ring and how the Google+ hover looks corrupt.

  • Chris

    Jonathan,

    I’ve followed your instructions above but still cant seem to disable these icons, presumably the line position has changed since your post with version updates etc? Are you able to tell me which line of code i should add Step 1 to, or which line it is on the current version?

    Thanks

  • Sunny
  • http://www.apertureless.de/ Jakub

    Hey I’ve got a problem. Using a theme that uses excpert in the category view and the plugin is not working. I edited the template and added after the line the code provided above. But it’s still not showing up.

Powered by AlterVista