Custom Facebook Feed - Version 1.2.3

Version Description

  • Added clear fix
Download this release

Release Info

Developer smashballoon
Plugin Icon 128x128 Custom Facebook Feed
Version 1.2.3
Comparing to
See all releases

Code changes from version 1.5 to 1.2.3

README.txt CHANGED
@@ -1,19 +1,29 @@
1
=== Custom Facebook Feed ===
2
Contributors: smashballoon
3
- Tags: facebook, social, feed, status
4
Requires at least: 3.0
5
Tested up to: 3.5.1
6
- Stable tag: 1.0
7
License: GPLv2 or later
8
License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
10
- The Custom Facebook Feed allows you to display a customizable Facebook feed of any public Facebook page or group on your website.
11
12
== Description ==
13
14
- The Custom Facebook Feed allows you to display a customizable Facebook feed of any public Facebook page or group on your website. Other Facebook plugins are Facebook branded and as they use iframes they don't allow you to customize the look, feel and functionality yourself. The Custom Facebook Feed is 100% customizable and by default inherits your theme's style.
15
16
- To display photos and videos in your feed try out a demo of the PRO version on the [Custom Facebook Feed website](http://smashballoon.com/custom-facebook-feed/demo "Custom Facebook Feed Demo").
17
18
== Installation ==
19
@@ -22,8 +32,52 @@ To display photos and videos in your feed try out a demo of the PRO version on t
22
3. Navigate to the plugin settings page to configure your feed.
23
4. Use the shortcode `[custom-facebook-feed]` in your page, post or widget to display your feed.
24
5. You can display multiple feeds of different Facebook pages by specifying a Page ID directly in the shortcode: `[custom-facebook-feed id=SarahsBakery show=5]`.
25
26
== Changelog ==
27
28
= 1.0 =
29
* Launch!
1
=== Custom Facebook Feed ===
2
Contributors: smashballoon
3
+ Tags: facebook, custom, customizable, feed, seo, search engine, responsive, mobile, shortcode, social, status
4
Requires at least: 3.0
5
Tested up to: 3.5.1
6
+ Stable tag: 1.2.3
7
License: GPLv2 or later
8
License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
10
+ The Custom Facebook Feed allows you to display a customizable Facebook feed of any public Facebook page on your website.
11
12
== Description ==
13
14
+ Display a **customizable**, **responsive** and **search engine crawlable** version of your Facebook feed on your WordPress site.
15
16
+ Other Facebook plugins use iframes to show your feed which don't allow you to customize how they look, aren't responsive and are not crawlable by search engines. The Custom Facebook Feed inherits your theme's style to display a feed which is responsive, crawlable and seamlessly matches the look and feel of your site.
17
+
18
+ * **Completely Customizable** - by default inherits your theme's styles
19
+ * **Feed content is crawlable by search engines adding SEO value to your site** - other Facebook plugins embed the feed using iframes which are not crawlable
20
+ * **Completely responsive and mobile optimized** - works on any screen size
21
+ * Use the shortcode to display the feed in a page, post or widget anywhere on your site
22
+ * Limit the number of posts to be shown in your feed
23
+ * Set a maximum length for both the post title and body text
24
+ * Use the shortcode to display feeds from multiple Facebook pages anywhere on your site
25
+
26
+ To display photos, videos and the number of likes, shares and comments for each post then [upgrade to the PRO version](http://smashballoon.com/custom-facebook-feed/wordpress-plugin/ "Custom Facebook Feed PRO"). Try out the [PRO demo](http://smashballoon.com/custom-facebook-feed/demo "Custom Facebook Feed Demo").
27
28
== Installation ==
29
32
3. Navigate to the plugin settings page to configure your feed.
33
4. Use the shortcode `[custom-facebook-feed]` in your page, post or widget to display your feed.
34
5. You can display multiple feeds of different Facebook pages by specifying a Page ID directly in the shortcode: `[custom-facebook-feed id=SarahsBakery show=5]`.
35
+ 6. You can limit the length of the title and body text by using `titlelength=100` and `bodylength=150` (for example) in the shortcode. `[custom-facebook-feed titlelength=100 bodylength=150]`.
36
+
37
+ == Frequently Asked Questions ==
38
+
39
+ = How do I find the Page ID of my Facebook page? =
40
+
41
+ If you have a Facebook page with a URL like this: `https://www.facebook.com/Your_Page_Name` then the Page ID is just `Your_Page_Name`. If your page URL is structured like this: `https://www.facebook.com/pages/Your_Page_Name/123654123654123` then the Page ID is actually the number at the end, so in this case `123654123654123`.
42
+
43
+ = Are there any limitations on which page feeds I can display? =
44
+
45
+ The feed you�re trying to display has to be a publicly accessible page. This means that you can�t display the feed from your own personal profile or a group. This is to do with Facebook�s privacy policies. You can�t display a non-public feed publicly.
46
+
47
+ If your page has any restrictions on it (age, for example) then it means that people have to be signed into Facebook in order to view your page. This isn�t desirable for most pages as it means that it isn�t accessible by people who don�t have a Facebook account and that your page can�t be crawled and indexed by search engines.
48
+
49
+ An easy way to determine whether your page is set to public is to sign out of your Facebook account and try to visit your page. If Facebook forces you to sign in to view your page then it isn�t public. You can change your page to public in your Facebook page settings simply by removing any restrictions you have on it, which will then allow the Custom Facebook Feed plugin to access and display your feed.
50
+
51
+ = What's an Access Token and why do I need one? =
52
+
53
+ An Access Token is required by Facebook in order to access their feeds. Don't worry, it's easy to get one. Just follow the step-by-step instructions [here](http://smashballoon.com/custom-facebook-feed/access-token/ "Getting an Access Token"). to get yours. Your Access Token will never expire.
54
+
55
+ = Can I show photos and videos in my feed? =
56
+
57
+ This plugin only allows you to display text updates from your feed. To display photos and videos in your feed you need to upgrade to the PRO version of the plugin. Try out a demo of the PRO version on the [Custom Facebook Feed website](http://smashballoon.com/custom-facebook-feed/demo "Custom Facebook Feed Demo"), and find out more about the PRO version [here](http://smashballoon.com/custom-facebook-feed/wordpress-plugin/ "Custom Facebook Feed PRO").
58
+
59
+ = Is the content of my feed crawlable by search engines? =
60
+
61
+ It sure is. Unlike other Facebook plugins which use iframes to embed your feed into your page once it�s loaded, the Custom Facebook Feed uses PHP to embed your feed content directly into your page. This adds dynamic, search engine crawlable content to your site.
62
+
63
+ == Screenshots ==
64
+
65
+ 1. Feed displayed in a page or post. By default the feed inherits your theme's default styles and is completely responsive.
66
+ 2. Feed displayed in a side widget.
67
+ 3. Configuring the plugin
68
+ 4. Adding the shortcode to your page or post. The shortcode parameters are optional and can be used to override the default settings you set on the plugin settings page
69
+ 5. Adding the shortcode to a widget
70
71
== Changelog ==
72
73
+ = 1.2.3 =
74
+ * Added clear fix
75
+
76
+ = 1.2.1 =
77
+ * Minor bug fixes
78
+
79
+ = 1.2 =
80
+ * Added the ability to define a maximum length for both the post title and body text
81
+
82
= 1.0 =
83
* Launch!
css/style.css CHANGED
@@ -94,4 +94,19 @@
94
float: left;
95
width: 100%;
96
margin: 10px 0 0 -10px;
97
}
94
float: left;
95
width: 100%;
96
margin: 10px 0 0 -10px;
97
+ }
98
+
99
+ /* Clear fix */
100
+ .clear:after {
101
+ clear: both;
102
+ content: ".";
103
+ display: block;
104
+ height: 0;
105
+ visibility: hidden;
106
+ }
107
+ .clear {
108
+ display: inline-block;
109
+ }
110
+ .clear {
111
+ display: block;
112
}
custom-facebook-feed-admin.php CHANGED
@@ -12,11 +12,15 @@ function cff_settings_page() {
12
$access_token = 'cff_access_token';
13
$page_id = 'cff_page_id';
14
$num_show = 'cff_num_show';
15
16
// Read in existing option value from database
17
$access_token_val = get_option( $access_token );
18
$page_id_val = get_option( $page_id );
19
$num_show_val = get_option( $num_show );
20
21
// See if the user has posted us some information. If they did, this hidden field will be set to 'Y'.
22
if( isset($_POST[ $hidden_field_name ]) && $_POST[ $hidden_field_name ] == 'Y' ) {
@@ -24,11 +28,15 @@ function cff_settings_page() {
24
$access_token_val = $_POST[ $access_token ];
25
$page_id_val = $_POST[ $page_id ];
26
$num_show_val = $_POST[ $num_show ];
27
28
// Save the posted value in the database
29
update_option( $access_token, $access_token_val );
30
update_option( $page_id, $page_id_val );
31
update_option( $num_show, $num_show_val );
32
33
// Put an settings updated message on the screen
34
?>
@@ -96,6 +104,42 @@ function cff_settings_page() {
96
97
</table>
98
99
<?php submit_button(); ?>
100
101
@@ -103,15 +147,15 @@ function cff_settings_page() {
103
104
<hr />
105
106
- <h4>How to use</h4>
107
108
<p>Copy and paste this shortcode directly into the page, post or widget where you'd like the feed to show up:</p>
109
110
<input type="text" value="[custom-facebook-feed]" size="23" />
111
112
- <p>You can override the Page ID and the number of posts directly in the shortcode like so:</p>
113
114
- <p>[custom-facebook-feed <b>id=Your_Page_ID show=3</b>]</p>
115
116
<br /><br /><a href="http://smashballoon.com/custom-facebook-feed/" target="_blank">Plugin Support</a>
117
12
$access_token = 'cff_access_token';
13
$page_id = 'cff_page_id';
14
$num_show = 'cff_num_show';
15
+ $cff_title_length = 'cff_title_length';
16
+ $cff_body_length = 'cff_body_length';
17
18
// Read in existing option value from database
19
$access_token_val = get_option( $access_token );
20
$page_id_val = get_option( $page_id );
21
$num_show_val = get_option( $num_show );
22
+ $cff_title_length_val = get_option( $cff_title_length );
23
+ $cff_body_length_val = get_option( $cff_body_length );
24
25
// See if the user has posted us some information. If they did, this hidden field will be set to 'Y'.
26
if( isset($_POST[ $hidden_field_name ]) && $_POST[ $hidden_field_name ] == 'Y' ) {
28
$access_token_val = $_POST[ $access_token ];
29
$page_id_val = $_POST[ $page_id ];
30
$num_show_val = $_POST[ $num_show ];
31
+ $cff_title_length_val = $_POST[ $cff_title_length ];
32
+ $cff_body_length_val = $_POST[ $cff_body_length ];
33
34
// Save the posted value in the database
35
update_option( $access_token, $access_token_val );
36
update_option( $page_id, $page_id_val );
37
update_option( $num_show, $num_show_val );
38
+ update_option( $cff_title_length, $cff_title_length_val );
39
+ update_option( $cff_body_length, $cff_body_length_val );
40
41
// Put an settings updated message on the screen
42
?>
104
105
</table>
106
107
+ <br />
108
+ <h3><?php _e('Post Formatting'); ?></h3>
109
+
110
+
111
+ <table class="form-table">
112
+
113
+ <tbody>
114
+
115
+ <tr valign="top">
116
+
117
+ <th scope="row"><?php _e('Maximum Post Title Length'); ?></th>
118
+
119
+ <td>
120
+
121
+ <input name="cff_title_length" type="text" value="<?php esc_attr_e( $cff_title_length_val ); ?>" size="4" /> <span>Characters.</span> <i style="color: #666; font-size: 11px; margin-left: 5px;">(Leave empty to set no maximum length)</i>
122
+
123
+ </td>
124
+
125
+ </tr>
126
+
127
+ <tr valign="top">
128
+
129
+ <th scope="row"><?php _e('Maximum Post Body Text Length'); ?></th>
130
+
131
+ <td>
132
+
133
+ <input name="cff_body_length" type="text" value="<?php esc_attr_e( $cff_body_length_val ); ?>" size="4" /> <span>Characters.</span> <i style="color: #666; font-size: 11px; margin-left: 5px;">(Leave empty to set no maximum length)</i>
134
+
135
+ </td>
136
+
137
+ </tr>
138
+
139
+ </tbody>
140
+
141
+ </table>
142
+
143
<?php submit_button(); ?>
144
145
147
148
<hr />
149
150
+ <h4>Displaying your Feed</h4>
151
152
<p>Copy and paste this shortcode directly into the page, post or widget where you'd like the feed to show up:</p>
153
154
<input type="text" value="[custom-facebook-feed]" size="23" />
155
156
+ <p>You can override the settings above directly in the shortcode like so:</p>
157
158
+ <p>[custom-facebook-feed <b>id=Your_Page_ID show=3 titlelength=100 bodylength=150</b>]</p>
159
160
<br /><br /><a href="http://smashballoon.com/custom-facebook-feed/" target="_blank">Plugin Support</a>
161
custom-facebook-feed.php CHANGED
@@ -3,7 +3,7 @@
3
Plugin Name: Custom Facebook Feed
4
Plugin URI: http://smashballoon.com/custom-facebook-feed
5
Description: Add a completely customizable Facebook feed to your WordPress site
6
- Version: 1.0
7
Author: Smash Balloon
8
Author URI: http://smashballoon.com/
9
License: GPLv2 or later
@@ -39,7 +39,9 @@ function display_cff($atts) {
39
$atts = shortcode_atts(
40
array(
41
'id' => get_option('cff_page_id'),
42
- 'show' => get_option('cff_num_show')
43
), $atts);
44
45
//Assign the Access Token and Page ID variables
@@ -75,10 +77,34 @@ function display_cff($atts) {
75
$content .= '<div class="cff-item">';
76
77
//Text/title/description/date
78
- if (!empty($news->story)) { $content .= '<h4>' . $news->story . '</h4>'; }
79
- if (!empty($news->message)) { $content .= '<h4>' . $news->message . '</h4>'; }
80
- if (!empty($news->description)) { $content .= '<p>' . $news->description . '</p>'; }
81
82
$content .= '<p class="cff-date">Posted '. timeSince(strtotime($news->created_time)) . ' ago</p>';
83
84
@@ -93,6 +119,7 @@ function display_cff($atts) {
93
}
94
95
96
if (!empty($news->link)) {
97
$link = $news->link;
98
@@ -107,6 +134,8 @@ function display_cff($atts) {
107
$content .= '<a class="cff-viewpost" href="' . $link . '" title="' . $link_text . '">' . $link_text . '</a>';
108
}
109
110
$content .= '</div> <!-- end .cff-item -->';
111
112
};
@@ -114,7 +143,7 @@ function display_cff($atts) {
114
115
//Add the Like Box
116
$content .= '<div class="cff-likebox"><script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><fb:like-box href="http://www.facebook.com/' . $page_id . '" width="200" show_faces="false" stream="false" header="true"></fb:like-box></div>';
117
- $content .= '</div> <!-- end .Custom Facebook Feed -->';
118
119
//Return our feed HTML to display
120
return $content;
@@ -191,6 +220,8 @@ function cff_uninstall()
191
delete_option( 'cff_access_token' );
192
delete_option( 'cff_page_id' );
193
delete_option( 'cff_num_show' );
194
}
195
register_uninstall_hook( __FILE__, 'cff_uninstall' );
196
3
Plugin Name: Custom Facebook Feed
4
Plugin URI: http://smashballoon.com/custom-facebook-feed
5
Description: Add a completely customizable Facebook feed to your WordPress site
6
+ Version: 1.2.3
7
Author: Smash Balloon
8
Author URI: http://smashballoon.com/
9
License: GPLv2 or later
39
$atts = shortcode_atts(
40
array(
41
'id' => get_option('cff_page_id'),
42
+ 'show' => get_option('cff_num_show'),
43
+ 'titlelength' => get_option('cff_title_length'),
44
+ 'bodylength' => get_option('cff_body_length')
45
), $atts);
46
47
//Assign the Access Token and Page ID variables
77
$content .= '<div class="cff-item">';
78
79
//Text/title/description/date
80
+ //Get text limits
81
+ $title_limit = $atts['titlelength'];
82
+ $body_limit = $atts['bodylength'];
83
+
84
+ if (!empty($news->story)) {
85
+ $story_text = $news->story;
86
+ if (isset($title_limit) && $title_limit !== '') {
87
+ if (strlen($story_text) > $title_limit) $story_text = substr($story_text, 0, $title_limit) . '...';
88
+ }
89
+ $content .= '<h4>' . $story_text . '</h4>';
90
+ }
91
+ if (!empty($news->message)) {
92
+ $message_text = $news->message;
93
+ if (isset($title_limit) && $title_limit !== '') {
94
+ if (strlen($message_text) > $title_limit) $message_text = substr($message_text, 0, $title_limit) . '...';
95
+ }
96
+ $content .= '<h4>' . $message_text . '</h4>';
97
+ }
98
+ if (!empty($news->description)) {
99
+ $description_text = $news->description;
100
+ if (isset($body_limit) && $body_limit !== '') {
101
+ if (strlen($description_text) > $body_limit) $description_text = substr($description_text, 0, $body_limit) . '...';
102
+ }
103
+ $content .= '<p>' . $description_text . '</p>';
104
+ }
105
106
+
107
+ //Posted on
108
$content .= '<p class="cff-date">Posted '. timeSince(strtotime($news->created_time)) . ' ago</p>';
109
110
119
}
120
121
122
+ //Show link
123
if (!empty($news->link)) {
124
$link = $news->link;
125
134
$content .= '<a class="cff-viewpost" href="' . $link . '" title="' . $link_text . '">' . $link_text . '</a>';
135
}
136
137
+
138
+ //End item
139
$content .= '</div> <!-- end .cff-item -->';
140
141
};
143
144
//Add the Like Box
145
$content .= '<div class="cff-likebox"><script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><fb:like-box href="http://www.facebook.com/' . $page_id . '" width="200" show_faces="false" stream="false" header="true"></fb:like-box></div>';
146
+ $content .= '</div><div class="clear"></div> <!-- end .Custom Facebook Feed -->';
147
148
//Return our feed HTML to display
149
return $content;
220
delete_option( 'cff_access_token' );
221
delete_option( 'cff_page_id' );
222
delete_option( 'cff_num_show' );
223
+ delete_option( 'cff_title_length' );
224
+ delete_option( 'cff_body_length' );
225
}
226
register_uninstall_hook( __FILE__, 'cff_uninstall' );
227