Add Twitter, Facebook Like, Google plus one Social share - Version 2.0.0

Version Description

  • Added shortcode [tfg_social_share]
  • Option to disable social share for individual post and pages.
  • Thumbnail search functionality for facebook like.
  • Adjust width of individual social share button.
  • Configure count display for Google +1 and Twitter.
  • CSS included in separate file.
Download this release

Release Info

Developer BeingMaverick
Plugin Icon wp plugin Add Twitter, Facebook Like, Google plus one Social share
Version 2.0.0
Comparing to
See all releases

Code changes from version 1.1.1 to 2.0.0

Files changed (5) hide show
  1. readme.txt +25 -4
  2. tf_admin_page.php +93 -17
  3. tf_display.php +73 -73
  4. tfg_style.css +27 -0
  5. twitter-facebook-share.php +4 -2
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: beingmaverick
3
Plugin Site: http://www.searchtechword.com
4
Tags: Facebook like, twitter button, twitter share, Google +1 (plus one) button, Google plus one, Stumbleupon, social share, twitter facebook share, google +1 share
5
Requires at least: 2.8+
6
- Tested up to: 3.1.3
7
- Stable tag: 1.1.1
8
9
== Description ==
10
<br />
@@ -25,6 +25,14 @@ Option to load the script in header as well, if you wish to.
25
26
* Option to display on home page, static pages, category, tag, archive pages.
27
28
* Option to manually display the share box at any position.
29
30
@@ -39,7 +47,8 @@ Very easy to install, similar to rest of the plugins.
39
40
== Frequently Asked Questions ==
41
42
- If you have any doubts or question or want to customise the plugin then get in touch with me at [SearchTechWord Wordpress Plugin](http://www.searchtechword.com/about-searchtechword/)<br />
43
I will try and help as much as possible and answer all your queries. I am ready to add to more features if you demand for the same, all free of cost. Always there to help you.
44
45
== Screenshots ==
@@ -48,7 +57,15 @@ You can Check Screen Shots on my website. I use the same plugin to display Socia
48
49
== Changelog ==
50
51
- = 1.1.1=
52
* Fixed a small bug related to single page display.
53
* Added notice in settings page regarding floating left option.
54
@@ -68,6 +85,10 @@ You can Check Screen Shots on my website. I use the same plugin to display Socia
68
69
== Upgrade Notice ==
70
71
= 1.1.1 =
72
1 New feature and 3 bug fixes
73
3
Plugin Site: http://www.searchtechword.com
4
Tags: Facebook like, twitter button, twitter share, Google +1 (plus one) button, Google plus one, Stumbleupon, social share, twitter facebook share, google +1 share
5
Requires at least: 2.8+
6
+ Tested up to: 3.2
7
+ Stable tag: 2.0.0
8
9
== Description ==
10
<br />
25
26
* Option to display on home page, static pages, category, tag, archive pages.
27
28
+ * Shortcode [tfg_social_share] which can be inserted in test for any post or pages to display the socail share bar.
29
+
30
+ * Add a custom field "disable_social_share" with value "yes" to disable social share for specific pages or posts.
31
+
32
+ * Facebook Like thumbnail will now display thumbnail specific to the post or page.
33
+
34
+ * Adjust width of individual social share button configure count display.
35
+
36
* Option to manually display the share box at any position.
37
38
47
48
== Frequently Asked Questions ==
49
50
+ If you have any doubts or question or want to customise the plugin then get in touch with me at
51
+ [SearchTechWord Wordpress Plugin](http://www.searchtechword.com/about-searchtechword/)<br />
52
I will try and help as much as possible and answer all your queries. I am ready to add to more features if you demand for the same, all free of cost. Always there to help you.
53
54
== Screenshots ==
57
58
== Changelog ==
59
60
+ = 2.0.0 =
61
+ * Added shortcode [tfg_social_share]
62
+ * Option to disable social share for individual post and pages.
63
+ * Thumbnail search functionality for facebook like.
64
+ * Adjust width of individual social share button.
65
+ * Configure count display for Google +1 and Twitter.
66
+ * CSS included in separate file.
67
+
68
+ = 1.1.1 =
69
* Fixed a small bug related to single page display.
70
* Added notice in settings page regarding floating left option.
71
85
86
== Upgrade Notice ==
87
88
+ = 2.0.0 =
89
+
90
+ 3 new features and few bug fixes.
91
+
92
= 1.1.1 =
93
1 New feature and 3 bug fixes
94
tf_admin_page.php CHANGED
@@ -58,7 +58,11 @@ $show_in = array(
58
$option['left_space'] = esc_html($_POST['twitter_facebook_share_left_space']);
59
$option['bottom_space'] = esc_html($_POST['twitter_facebook_share_bottom_space']);
60
$option['float_position'] = esc_html($_POST['twitter_facebook_share_float_position']);
61
-
62
update_option($option_name, $option);
63
// Put a settings updated message on the screen
64
$out .= '<div class="updated"><p><strong>'.__('Settings saved.', 'menu-test' ).'</strong></p></div>';
@@ -82,17 +86,20 @@ $show_in = array(
82
$bkcolor = ($option['bkcolor']) ? 'checked="checked"' : '';
83
$jsload = ($option['jsload']) ? 'checked="checked"' : '';
84
$auto = ($option['auto']) ? 'checked="checked"' : '';
85
86
$out .= '
87
<div class="wrap">
88
- <div style="float:left; width:70%;">
89
<h2>'.__( 'Facebook and Twitter share buttons', 'menu-test' ).'</h2>
90
<form name="form1" method="post" action="">
91
-
92
<table>
93
-
94
- <tr><td valign="top" colspan="2"><h3>'.__("General Settings", 'menu-test' ).'</h3></td></tr>
95
-
96
<tr><td style="padding-bottom:20px;" valign="top">'.__("Auto Display", 'menu-test' ).':</td>
97
<td style="padding-bottom:20px;">
98
<input type="checkbox" name="twitter_facebook_share_auto_display" '.$auto.' />
@@ -170,9 +177,15 @@ $show_in = array(
170
<input type="text" name="twitter_facebook_share_twitter_id" value="'.$option['twitter_id'].'" size="30">
171
<span class="description">'.__("Specify your twitter id without @", 'menu-test' ).'</span>
172
</td></tr>
173
174
- <tr><td valign="top" colspan="2"><h3>'.__("Left Side Floating Specific Options", 'menu-test' ).'</h3></td></tr>
175
-
176
<tr><td style="padding-bottom:20px;" valign="top">'.__("Left Side Spacing", 'menu-test' ).':</td>
177
<td style="padding-bottom:20px;">
178
<input type="text" name="twitter_facebook_share_left_space" value="'.$option['left_space'].'" size="10">
@@ -191,25 +204,55 @@ $show_in = array(
191
<option value="absolute" '.$sel_absolute.' > '.__('Absolute Position', 'menu-test' ).'</option>
192
</select>
193
</td></tr>
194
195
<tr><td valign="top" colspan="2">
196
<p class="submit">
197
<input type="submit" name="Submit" class="button-primary" value="'.esc_attr('Save Changes').'" />
198
</p>
199
</td></tr>
200
-
201
-
202
- </table>
203
-
204
</form>
205
</div>
206
- <div style="float:left; margin-top:100px; width:30%;">
207
<table>
208
- <tr><td align="justify" width="80px">
209
- <h4>Support the Author</h4>
210
<p >If you liked the plugin and was useful to your site then please support to keep this project up and running. Maintenance and enhancement do cost. Show your appreciation and love.</p> </td></tr>
211
<tr>
212
- <td align="centre">
213
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
214
<input type="hidden" name="cmd" value="_s-xclick">
215
<input type="hidden" name="hosted_button_id" value="86FHBFVUYN45J">
@@ -220,8 +263,21 @@ $show_in = array(
220
</tr>
221
</table>
222
</div>
223
224
- <div style="clear:both;"></div>
225
</div>
226
';
227
echo $out;
@@ -269,6 +325,21 @@ function twitter_facebook_share_get_options_stored () {
269
$option['jsload'] = true;
270
}
271
272
return $option;
273
}
274
@@ -285,6 +356,11 @@ function twitter_facebook_share_get_options_default ($position='above', $border=
285
$option['left_space'] = $left_space;
286
$option['bottom_space'] = $bottom_space;
287
$option['float_position'] = $float_position;
288
return $option;
289
}
290
?>
58
$option['left_space'] = esc_html($_POST['twitter_facebook_share_left_space']);
59
$option['bottom_space'] = esc_html($_POST['twitter_facebook_share_bottom_space']);
60
$option['float_position'] = esc_html($_POST['twitter_facebook_share_float_position']);
61
+ $option['twitter_count'] = (isset($_POST['twitter_facebook_share_twitter_count']) and $_POST['twitter_facebook_share_twitter_count']=='on') ? true : false;
62
+ $option['google_count'] = (isset($_POST['twitter_facebook_share_google_count']) and $_POST['twitter_facebook_share_google_count']=='on') ? true : false;
63
+ $option['google_width'] = esc_html($_POST['twitter_facebook_share_google_width']);
64
+ $option['facebook_like_width'] = esc_html($_POST['twitter_facebook_share_facebook_like_width']);
65
+ $option['twitter_width'] = esc_html($_POST['twitter_facebook_share_twitter_width']);
66
update_option($option_name, $option);
67
// Put a settings updated message on the screen
68
$out .= '<div class="updated"><p><strong>'.__('Settings saved.', 'menu-test' ).'</strong></p></div>';
86
$bkcolor = ($option['bkcolor']) ? 'checked="checked"' : '';
87
$jsload = ($option['jsload']) ? 'checked="checked"' : '';
88
$auto = ($option['auto']) ? 'checked="checked"' : '';
89
+ $google_count = ($option['google_count']) ? 'checked="checked"' : '';
90
+ $twitter_count = ($option['twitter_count']) ? 'checked="checked"' : '';
91
92
$out .= '
93
<div class="wrap">
94
+
95
<h2>'.__( 'Facebook and Twitter share buttons', 'menu-test' ).'</h2>
96
+ <div id="poststuff" style="padding-top:10px; position:relative;">
97
+ <div style="float:left; width:74%; padding-right:1%;">
98
<form name="form1" method="post" action="">
99
+ <div class="postbox">
100
+ <h3>'.__("General options", 'menu-test' ).'</h3>
101
+ <div class="inside">
102
<table>
103
<tr><td style="padding-bottom:20px;" valign="top">'.__("Auto Display", 'menu-test' ).':</td>
104
<td style="padding-bottom:20px;">
105
<input type="checkbox" name="twitter_facebook_share_auto_display" '.$auto.' />
177
<input type="text" name="twitter_facebook_share_twitter_id" value="'.$option['twitter_id'].'" size="30">
178
<span class="description">'.__("Specify your twitter id without @", 'menu-test' ).'</span>
179
</td></tr>
180
+ </table>
181
+ </div>
182
+ </div>
183
184
+ <div class="postbox">
185
+ <h3>'.__("Left Side Floating Specific Options", 'menu-test' ).'</h3>
186
+ <div class="inside">
187
+ <table>
188
+
189
<tr><td style="padding-bottom:20px;" valign="top">'.__("Left Side Spacing", 'menu-test' ).':</td>
190
<td style="padding-bottom:20px;">
191
<input type="text" name="twitter_facebook_share_left_space" value="'.$option['left_space'].'" size="10">
204
<option value="absolute" '.$sel_absolute.' > '.__('Absolute Position', 'menu-test' ).'</option>
205
</select>
206
</td></tr>
207
+ </table>
208
+ </div>
209
+ </div>
210
+
211
+ <div class="postbox">
212
+ <h3>'.__("Adjust Width and Count Display", 'menu-test' ).'</h3>
213
+ <div class="inside">
214
+ <table>
215
+ <tr><td style="padding-bottom:20px; padding-right:10px;" valign="top">'.__("Facebook Button width", 'menu-test' ).':</td>
216
+ <td style="padding-bottom:20px;">
217
+ <input type="text" name="twitter_facebook_share_facebook_like_width" value="'.stripslashes($option['facebook_like_width']).'" size="10">px<br />
218
+ </td>
219
+ <td style="padding-bottom:20px; padding-left:50px; padding-right:10px;" valign="top">'.__("Google +1 Button width", 'menu-test' ).':</td>
220
+ <td style="padding-bottom:20px;">
221
+ <input type="text" name="twitter_facebook_share_google_width" value="'.stripslashes($option['google_width']).'" size="10">px<br />
222
+ </td></tr>
223
+ <tr><td style="padding-bottom:20px; padding-right:10px;" valign="top">'.__("Twitter Button width", 'menu-test' ).':</td>
224
+ <td style="padding-bottom:20px;">
225
+ <input type="text" name="twitter_facebook_share_twitter_width" value="'.stripslashes($option['twitter_width']).'" size="10"> px <br />
226
+ </td></tr>
227
+ <tr><td style="padding-bottom:20px; padding-right:10px;" valign="top">'.__("Google +1 counter", 'menu-test' ).':</td>
228
+ <td style="padding-bottom:20px;">
229
+ <input type="checkbox" name="twitter_facebook_share_google_count" '.$google_count.' />
230
+ </td></tr>
231
+ <tr><td style="padding-bottom:20px; padding-right:10px;" valign="top">'.__("Twitter counter", 'menu-test' ).':</td>
232
+ <td style="padding-bottom:20px;">
233
+ <input type="checkbox" name="twitter_facebook_share_twitter_count" '.$twitter_count.' />
234
+ </td></tr>
235
+ </table>
236
+ </div>
237
+ </div>
238
239
<tr><td valign="top" colspan="2">
240
<p class="submit">
241
<input type="submit" name="Submit" class="button-primary" value="'.esc_attr('Save Changes').'" />
242
</p>
243
</td></tr>
244
</form>
245
</div>
246
+
247
+ <div style="float:right; width:25%;">
248
+ <div class="postbox">
249
+ <h3>'.__("Support The Author", 'menu-test' ).'</h3>
250
+ <div class="inside">
251
<table>
252
+ <tr><td align="justify">
253
<p >If you liked the plugin and was useful to your site then please support to keep this project up and running. Maintenance and enhancement do cost. Show your appreciation and love.</p> </td></tr>
254
<tr>
255
+ <td align="center">
256
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
257
<input type="hidden" name="cmd" value="_s-xclick">
258
<input type="hidden" name="hosted_button_id" value="86FHBFVUYN45J">
263
</tr>
264
</table>
265
</div>
266
+ </div>
267
+ <div class="postbox">
268
+ <h3>'.__("Additional Info", 'menu-test' ).'</h3>
269
+ <div class="inside">
270
+ <table>
271
+ <tr><td align="justify">
272
+ <ul>
273
+ <li>Shortcode <strong>[tfg_social_share]</strong> to add the social share bar to specific pages.</li>
274
+ <li>Custom field "<strong>disable_social_share</strong>" with value "yes" to exclude specific post or pages.</li>
275
+ </td></tr>
276
+ </tr>
277
+ </table>
278
+ </div>
279
+ </div>
280
281
</div>
282
';
283
echo $out;
325
$option['jsload'] = true;
326
}
327
328
+ if (!isset($option['facebook_like_width'])) {
329
+ $option['facebook_like_width'] = '85';
330
+ }
331
+ if (!isset($option['twitter_width'])) {
332
+ $option['twitter_width'] = '85';
333
+ }
334
+ if (!isset($option['google_width'])) {
335
+ $option['google_width'] = '85';
336
+ }
337
+ if (!isset($option['twitter_count'])) {
338
+ $option['twitter_count'] = true;
339
+ }
340
+ if (!isset($option['google_count'])) {
341
+ $option['google_count'] = true;
342
+ }
343
return $option;
344
}
345
356
$option['left_space'] = $left_space;
357
$option['bottom_space'] = $bottom_space;
358
$option['float_position'] = $float_position;
359
+ $option['facebook_like_width'] = '85';
360
+ $option['twitter_width'] = '85';
361
+ $option['google_width'] = '85';
362
+ $option['google_count'] = true;
363
+ $option['twitter_count'] = true;
364
return $option;
365
}
366
?>
tf_display.php CHANGED
@@ -21,16 +21,28 @@ function twitter_facebook_share_init() {
21
wp_enqueue_script('twitter_facebook_share_google', 'http://apis.google.com/js/plusone.js','','',$option['jsload']);
22
}
23
24
25
}
26
27
-
28
function kc_twitter_facebook_contents($content)
29
{
30
global $single;
31
- $output = kc_social_share();
32
$option = twitter_facebook_share_get_options_stored();
33
- if (is_single() && ($option['show_in']['posts'])) {
34
if ($option['position'] == 'above')
35
return $output . $content;
36
if ($option['position'] == 'below')
@@ -41,7 +53,7 @@ function kc_twitter_facebook_contents($content)
41
return $output . $content . $output;
42
}
43
if (is_home() && ($option['show_in']['home_page'])){
44
- $option = twitter_facebook_share_get_options_stored();
45
if ($option['position'] == 'above')
46
return $output . $content;
47
if ($option['position'] == 'below')
@@ -51,7 +63,8 @@ function kc_twitter_facebook_contents($content)
51
if ($option['position'] == 'both')
52
return $output . $content . $output;
53
}
54
- if (is_singular() && ($option['show_in']['pages'])) {
55
if ($option['position'] == 'above')
56
return $output . $content;
57
if ($option['position'] == 'below')
@@ -62,6 +75,7 @@ function kc_twitter_facebook_contents($content)
62
return $output . $content . $output;
63
}
64
if (is_category() && ($option['show_in']['categories'])) {
65
if ($option['position'] == 'above')
66
return $output . $content;
67
if ($option['position'] == 'below')
@@ -72,6 +86,7 @@ function kc_twitter_facebook_contents($content)
72
return $output . $content . $output;
73
}
74
if (is_tag() && ($option['show_in']['tags'])) {
75
if ($option['position'] == 'above')
76
return $output . $content;
77
if ($option['position'] == 'below')
@@ -82,6 +97,7 @@ function kc_twitter_facebook_contents($content)
82
return $output . $content . $output;
83
}
84
if (is_author() && ($option['show_in']['authors'])) {
85
if ($option['position'] == 'above')
86
return $output . $content;
87
if ($option['position'] == 'below')
@@ -92,6 +108,7 @@ function kc_twitter_facebook_contents($content)
92
return $output . $content . $output;
93
}
94
if (is_search() && ($option['show_in']['search'])) {
95
if ($option['position'] == 'above')
96
return $output . $content;
97
if ($option['position'] == 'below')
@@ -102,6 +119,7 @@ function kc_twitter_facebook_contents($content)
102
return $output . $content . $output;
103
}
104
if (is_date() && ($option['show_in']['date_arch'])) {
105
if ($option['position'] == 'above')
106
return $output . $content;
107
if ($option['position'] == 'below')
@@ -117,80 +135,41 @@ function kc_twitter_facebook_contents($content)
117
// Function to manually display related posts.
118
function kc_add_social_share()
119
{
120
- $output = kc_social_share();
121
echo $output;
122
}
123
124
125
126
- function kc_social_share()
127
{
128
//GET ARRAY OF STORED VALUES
129
$option = twitter_facebook_share_get_options_stored();
130
if (empty($option['bkcolor_value']))
131
$option['bkcolor_value'] = '#F0F4F9';
132
133
- ?>
134
- <style type="text/css">
135
- #leftcontainerBox {
136
- <?php if ($option['border'] == 'flat')
137
- echo 'border:1px solid #808080;';
138
- if ($option['border'] == 'round')
139
- echo 'border:1px solid #808080;
140
- border-radius:5px 5px 5px 5px;
141
- box-shadow:2px 2px 5px rgba(0,0,0,0.3);'; ?>
142
- float:left;
143
- position: <?php echo $option['float_position']; ?>;
144
- top:<?php echo $option['bottom_space']; ?>;
145
- left:<?php echo $option['left_space'] ?>;
146
- z-index:1;
147
- <?php if ($option['bkcolor'] == true)
148
- echo 'background-color:'; echo $option['bkcolor_value']; ?>
149
- }
150
-
151
- #leftcontainerBox .buttons {
152
- float:left;
153
- clear:both;
154
- margin:4px 4px 4px 4px;
155
- width:55px;
156
- height:60px;
157
- padding-bottom:2px;
158
- }
159
-
160
-
161
- #bottomcontainerBox {
162
- <?php if ($option['border'] == 'flat')
163
- echo 'border:1px solid #808080;';
164
- if ($option['border'] == 'round')
165
- echo 'border:1px solid #808080;
166
- border-radius:5px 5px 5px 5px;
167
- box-shadow:2px 2px 5px rgba(0,0,0,0.3);'; ?>
168
- float:left;
169
- height:30px;
170
- width:100%;
171
- <?php if ($option['bkcolor'] == true)
172
- echo 'background-color:'; echo $option['bkcolor_value']; ?>
173
- }
174
-
175
- #bottomcontainerBox .buttons {
176
- float:left;
177
- height:30px;
178
- width:85px;
179
- margin:4px 4px 4px 4px;
180
- }
181
-
182
- </style>
183
- <?php
184
- $post_link = esc_url(get_permalink());
185
$post_title = get_the_title();
186
- if ($option['position'] == 'left' && ( !is_single() && !is_singular()))
187
- $option['position'] = 'above';
188
if ($option['position'] == 'left'){
189
- $output = '<div id="leftcontainerBox">';
190
if ($option['active_buttons']['facebook_like']==true) {
191
$output .= '
192
<div class="buttons">
193
- <iframe src="http://www.facebook.com/plugins/like.php?href=' . rawurlencode(get_permalink()) . '&amp;layout=box_count&amp;show_faces=false&amp;action=like&amp;font=verdana&amp;colorscheme=light" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:50px; height:60px;" allowTransparency="true"></iframe>
194
</div>';
195
}
196
@@ -226,35 +205,37 @@ margin:4px 4px 4px 4px;
226
227
if (($option['position'] == 'below') || ($option['position'] == 'above') || ($option['position'] == 'both'))
228
{
229
- $output = '<div id="bottomcontainerBox">';
230
if ($option['active_buttons']['facebook_like']==true) {
231
$output .= '
232
- <div class="buttons">
233
- <iframe src="http://www.facebook.com/plugins/like.php?href=' . rawurlencode(get_permalink()) . '&amp;layout=button_count&amp;show_faces=false&amp;width=100&amp;action=like&amp;font=verdana&amp;colorscheme=light&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:100px; height:21px;" allowTransparency="true"></iframe></div>';
234
}
235
236
if ($option['active_buttons']['Google_plusone']==true) {
237
$output .= '
238
- <div class="buttons">
239
- <g:plusone size="medium" href="' . $post_link . '"></g:plusone>
240
</div>';
241
}
242
243
if ($option['active_buttons']['stumbleupon']==true) {
244
$output .= '
245
- <div class="buttons"><script src="http://www.stumbleupon.com/hostedbadge.php?s=1&amp;r='.$post_link.'"></script></div>';
246
}
247
248
if ($option['active_buttons']['twitter']==true) {
249
if ($option['twitter_id'] != ''){
250
$output .= '
251
- <div class="buttons">
252
- <a href="http://twitter.com/share" class="twitter-share-button" data-url="'. $post_link .'" data-text="'. $post_title . '" data-count="horizontal" data-via="'. $option['twitter_id'] . '">Tweet</a>
253
</div>';
254
} else {
255
$output .= '
256
- <div class="buttons">
257
- <a href="http://twitter.com/share" class="twitter-share-button" data-url="'. $post_link .'" data-text="'. $post_title . '" data-count="horizontal">Tweet</a>
258
</div>';
259
}
260
}
@@ -264,4 +245,23 @@ margin:4px 4px 4px 4px;
264
return $output;
265
}
266
}
267
?>
21
wp_enqueue_script('twitter_facebook_share_google', 'http://apis.google.com/js/plusone.js','','',$option['jsload']);
22
}
23
24
+ wp_enqueue_style('tfg_style', '/wp-content/plugins/twitter-facebook-google-plusone-share/tfg_style.css');
25
26
}
27
28
function kc_twitter_facebook_contents($content)
29
+ {
30
+ return kc_twitter_facebook($content,'content');
31
+ }
32
+
33
+ function kc_twitter_facebook_excerpt($content)
34
+ {
35
+ return kc_twitter_facebook($content,'excerpt');
36
+ }
37
+
38
+ function kc_twitter_facebook($content, $filter)
39
{
40
global $single;
41
+
42
$option = twitter_facebook_share_get_options_stored();
43
+ $custom_disable = get_post_custom_values('disable_social_share');
44
+ if (is_single() && ($option['show_in']['posts']) && ($custom_disable[0] != 'yes')) {
45
+ $output = kc_social_share('auto');
46
if ($option['position'] == 'above')
47
return $output . $content;
48
if ($option['position'] == 'below')
53
return $output . $content . $output;
54
}
55
if (is_home() && ($option['show_in']['home_page'])){
56
+ $output = kc_social_share('auto');
57
if ($option['position'] == 'above')
58
return $output . $content;
59
if ($option['position'] == 'below')
63
if ($option['position'] == 'both')
64
return $output . $content . $output;
65
}
66
+ if (is_page() && ($option['show_in']['pages']) && ($custom_disable[0] != 'yes')) {
67
+ $output = kc_social_share('auto');
68
if ($option['position'] == 'above')
69
return $output . $content;
70
if ($option['position'] == 'below')
75
return $output . $content . $output;
76
}
77
if (is_category() && ($option['show_in']['categories'])) {
78
+ $output = kc_social_share('auto');
79
if ($option['position'] == 'above')
80
return $output . $content;
81
if ($option['position'] == 'below')
86
return $output . $content . $output;
87
}
88
if (is_tag() && ($option['show_in']['tags'])) {
89
+ $output = kc_social_share('auto');
90
if ($option['position'] == 'above')
91
return $output . $content;
92
if ($option['position'] == 'below')
97
return $output . $content . $output;
98
}
99
if (is_author() && ($option['show_in']['authors'])) {
100
+ $output = kc_social_share('auto');
101
if ($option['position'] == 'above')
102
return $output . $content;
103
if ($option['position'] == 'below')
108
return $output . $content . $output;
109
}
110
if (is_search() && ($option['show_in']['search'])) {
111
+ $output = kc_social_share('auto');
112
if ($option['position'] == 'above')
113
return $output . $content;
114
if ($option['position'] == 'below')
119
return $output . $content . $output;
120
}
121
if (is_date() && ($option['show_in']['date_arch'])) {
122
+ $output = kc_social_share('auto');
123
if ($option['position'] == 'above')
124
return $output . $content;
125
if ($option['position'] == 'below')
135
// Function to manually display related posts.
136
function kc_add_social_share()
137
{
138
+ $output = kc_social_share('manual');
139
echo $output;
140
}
141
142
143
144
+ function kc_social_share($source)
145
{
146
//GET ARRAY OF STORED VALUES
147
$option = twitter_facebook_share_get_options_stored();
148
if (empty($option['bkcolor_value']))
149
$option['bkcolor_value'] = '#F0F4F9';
150
+ $border ='';
151
+ if ($option['border'] == 'flat')
152
+ $border = 'border:1px solid #808080;';
153
+ else if ($option['border'] == 'round')
154
+ $border = 'border:1px solid #808080; border-radius:5px 5px 5px 5px; box-shadow:2px 2px 5px rgba(0,0,0,0.3);';
155
+
156
+ if ($option['bkcolor'] == true)
157
+ $bkcolor = 'background-color:' . $option['bkcolor_value']. ';';
158
+ else
159
+ $bkcolor = '';
160
161
+ $post_link = get_permalink();
162
$post_title = get_the_title();
163
+ if ($option['position'] == 'left' && ( !is_single() && !is_page()))
164
+ if (($source != 'manual') || ($source != 'shortcode'))
165
+ $option['position'] = 'above';
166
+
167
if ($option['position'] == 'left'){
168
+ $output = '<div id="leftcontainerBox" style="' .$border. $bkcolor. 'position:' .$option['float_position']. '; top:' .$option['bottom_space']. '; left:' .$option['left_space']. ';">';
169
if ($option['active_buttons']['facebook_like']==true) {
170
$output .= '
171
<div class="buttons">
172
+ <iframe src="http://www.facebook.com/plugins/like.php?href=' . urlencode($post_link) . '&amp;layout=box_count&amp;show_faces=false&amp;action=like&amp;font=verdana&amp;colorscheme=light" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:50px; height:60px;" allowTransparency="true"></iframe>
173
</div>';
174
}
175
205
206
if (($option['position'] == 'below') || ($option['position'] == 'above') || ($option['position'] == 'both'))
207
{
208
+ $output = '<div id="bottomcontainerBox" style="' .$border. $bkcolor. '">';
209
if ($option['active_buttons']['facebook_like']==true) {
210
$output .= '
211
+ <div style="float:left; width:' .$option['facebook_like_width']. 'px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
212
+ <iframe src="http://www.facebook.com/plugins/like.php?href=' . urlencode($post_link) . '&amp;layout=button_count&amp;show_faces=false&amp;width='.$option['facebook_like_width'].'&amp;action=like&amp;font=verdana&amp;colorscheme=light&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width='.$option['facebook_like_width'].'px; height:21px;" allowTransparency="true"></iframe></div>';
213
}
214
215
if ($option['active_buttons']['Google_plusone']==true) {
216
+ $data_count = ($option['google_count']) ? '' : 'count="false"';
217
$output .= '
218
+ <div style="float:left; width:' .$option['google_width']. 'px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
219
+ <g:plusone size="medium" href="' . $post_link . '"'.$data_count.'></g:plusone>
220
</div>';
221
}
222
223
if ($option['active_buttons']['stumbleupon']==true) {
224
$output .= '
225
+ <div style="float:left; width:85px; padding-right:10px; margin:4px 4px 4px 4px;height:30px;"><script src="http://www.stumbleupon.com/hostedbadge.php?s=1&amp;r='.$post_link.'"></script></div>';
226
}
227
228
if ($option['active_buttons']['twitter']==true) {
229
+ $data_count = ($option['twitter_count']) ? 'horizontal' : 'none';
230
if ($option['twitter_id'] != ''){
231
$output .= '
232
+ <div style="float:left; width:' .$option['twitter_width']. 'px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
233
+ <a href="http://twitter.com/share" class="twitter-share-button" data-url="'. $post_link .'" data-text="'. $post_title . '" data-count="'.$data_count.'" data-via="'. $option['twitter_id'] . '">Tweet</a>
234
</div>';
235
} else {
236
$output .= '
237
+ <div style="float:left; width:' .$option['twitter_width']. 'px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
238
+ <a href="http://twitter.com/share" class="twitter-share-button" data-url="'. $post_link .'" data-text="'. $post_title . '" data-count="'.$data_count.'">Tweet</a>
239
</div>';
240
}
241
}
245
return $output;
246
}
247
}
248
+
249
+ function tfg_social_share_shortcode () {
250
+ $output = kc_social_share('shortcode');
251
+ echo $output;
252
+ }
253
+
254
+ function fb_like_thumbnails()
255
+ {
256
+ global $posts;
257
+ $default = '';
258
+ $content = $posts[0]->post_content; // $posts is an array, fetch the first element
259
+ $output = preg_match_all( '/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $content, $matches);
260
+ if ( $output > 0 ) {
261
+ $thumb = $matches[1][0];
262
+ echo "\n\n<!-- Thumbnail for facebook like -->\n<link rel=\"image_src\" href=\"$thumb\" />\n\n";
263
+ }
264
+ else
265
+ $thumb = $default;
266
+ }
267
?>
tfg_style.css ADDED
@@ -0,0 +1,27 @@
1
+ /* CSS Document */
2
+
3
+ #leftcontainerBox {
4
+ float:left;
5
+ z-index: 1;
6
+ }
7
+
8
+ #leftcontainerBox .buttons {
9
+ float:left;
10
+ clear:both;
11
+ margin:4px 4px 4px 4px;
12
+ width:55px;
13
+ height:60px;
14
+ padding-bottom:2px;
15
+ }
16
+
17
+ #bottomcontainerBox {
18
+ float:left;
19
+ height:30px;
20
+ width:100%;
21
+ }
22
+
23
+ #bottomcontainerBox .buttons {
24
+ float:left;
25
+ height:30px;
26
+ margin:4px 4px 4px 4px;
27
+ }
twitter-facebook-share.php CHANGED
@@ -5,7 +5,7 @@ Description: WordPress plugin for twitter, facebook, Google +1 (plus one) and ot
5
Author: Kunal Chichkar
6
Author URI: http://www.searchtechword.com
7
Plugin URI: http://www.searchtechword.com/2011/06/wordpress-plugin-add-twitter-facebook-google-plus-one-share
8
- Version: 1.1.1
9
License: GPL
10
*/
11
/*
@@ -53,11 +53,13 @@ add_action('admin_menu', 'kc_twitter_facebook_admin_menu');
53
else
54
{
55
add_action('init', 'twitter_facebook_share_init');
56
$option = twitter_facebook_share_get_options_stored();
57
if($option['auto'] == true)
58
{
59
add_filter('the_content', 'kc_twitter_facebook_contents');
60
- add_filter('the_excerpt', 'kc_twitter_facebook_contents');
61
}
62
}
63
?>
5
Author: Kunal Chichkar
6
Author URI: http://www.searchtechword.com
7
Plugin URI: http://www.searchtechword.com/2011/06/wordpress-plugin-add-twitter-facebook-google-plus-one-share
8
+ Version: 2.0.0
9
License: GPL
10
*/
11
/*
53
else
54
{
55
add_action('init', 'twitter_facebook_share_init');
56
+ add_shortcode('tfg_social_share', 'tfg_social_share_shortcode' );
57
+ add_action('wp_head', 'fb_like_thumbnails');
58
$option = twitter_facebook_share_get_options_stored();
59
if($option['auto'] == true)
60
{
61
add_filter('the_content', 'kc_twitter_facebook_contents');
62
+ add_filter('the_excerpt', 'kc_twitter_facebook_excerpt');
63
}
64
}
65
?>