Categories
Facebook Tab manager Web Development WordPress

Facebook Tab Manager 2.8.7 Adds Theme / Template Options, Preloader Image

I figured out how to address a few requests for greater customization options and also how to add a preloader image if a pages are sometimes slow to load. The theme option was also partly inspired by my recent work on a Facebook extension to WP e-Commerce, which was a sort of spin-off of Facebook Tab Manager code.

I’m just starting the process of moving most documentation over to facebooktabmanager.com, so see the links below for more details.

Categories
Facebook Tab manager Web Development WordPress WP FB Commerce

Facebook Extension for WP e-Commerce

Based on the success of Facebook Tab Manager, I got contacted a few weeks ago by the makers of the WP e-Commerce plugin to consult on creating an extension that would allow merchants to display products with a version of their storefront embedded in a Facebook business page tab.

An early version is available for download here – http://wordpress.org/extend/plugins/wp-fb-commerce/ – and I’m at the stage where it would be helpful to get feedback. Also, since I don’t currently run a live e-commerce store, I’d like to to see what this looks like with a real assortment of products loaded into it. I’ve got a little Facebook Specials demo store running on the Carr Communications Facebook page, but the product listings aren’t particularly realistic.

This isn’t up in the WordPress plugins repository yet. Here is the description from the readme.txt

WP FB Commerce

WP FB Commerce is a companion plugin to GetShopped’s famous WP e-Commerce. Market featured products or your whole catalog on Facebook.


Contributors: davidfcarr, mufasa
Donate link: http://www.rsvpmaker.com
Tags: facebook, iframe, page tab, e-commerce, wp-e-commerce, shop, cart, paypal, authorize, stock control, ecommerce, shipping, tax
Requires at least: 3.0
Tested up to: 3.2.1
Stable tag: 0.1


Description

WP FB Commerce is a companion plugin to GetShopped’s famous WP e-Commerce. Display featured products or your whole catalog on Facebook and allow customers to check out directly within your Facebook business page.

This early release includes code adapted from Facebook Tab Manager for WordPress, customized for the e-commerce application. Use the provided theme for displaying products on Facebook or provide your own.

WP FB Commerce was created for GetShopped by Carr Communications Inc. http://www.carrcommunications.com

For more information about WP e-Commerce visit http://getshopped.org


Installation

  1. Upload the folder wp-fb-commerce to the /wp-content/plugins/ directory
  2. Activate the plugin through the ‘Plugins’ menu in WordPress
  3. Optionally, copy the fb-ec-theme subfolder to /wp-content/themes/ directory. This will allow you to modify the template files and style.css independently of the plugin code. It may also perform better.
  4. Register the URL for your storefront in the Facebook Developers utility (see explanation under Frequently Asked Questions).

Frequently Asked Questions

How do I add my storefront to Facebook?

WP FB Commerce displays your storefront as a tab on a Facebook business page. You will register a URL pointing to your web server in the Facebook Developers utility at https://developers.facebook.com/apps

Click ‘Create a New App’ and follow the instructions. Many of the fields on the app registration form are optional. The most critical fields to fill in for our purposes are in the Page Tab section where you will enter a Page Tab Name, Page Tab URL, and Secure Page Tab URL. You must be able to host SSL secured / https pages for this to work properly.

You can find the URLs to record on the ‘Products -> FB Featured’ and ‘Settings -> WP FB Commerce’ pages. You have a choice of either displaying products from the default view of your WP e-Commerce product catalog or a select list of featured products set on the Products -> FB Featured screen. The URLs include a query string parameter in the form of ?fbx=1 for the featured products list or ?fb=commerce for the default listing.

After saving the settings for your “app”, click the link on the left hand sidebar to View App Profile Page.

From the profile page, click the link for ‘Add to My Page’. Facebook will display a listing of all the pages you own or have editing rights to. Click the Add to Page button next to the page or pages you want this storefront view to appear on. Then navigate to your business page, and you should see the new tab displayed on the menu on the left side of the page.

If you are logged in as an administrator of the page, an ‘Edit’ link will be displayed at the bottom of the list of tabs (navigation links within the content for your page). This allows you to delete or rearrange the tabs. If you have a long list of tabs, you may need to click ‘More’ before the ‘Edit’ link will be displayed.

You can edit or rearrange the tabs.

How do I select Facebook featured products?

Look for an additional menu item under Products titled FB Featured. You may select up to 20 products to be displayed as featured offers.

How do I customize WP FB Commerce?

  • Visit the settings screen at Settings -> WP FB Commerce. You can add header (for example, including a logo) or footer, add custom CSS to be added dynamically, and specify navigation options.
  • You can create your own themes specifically for use with WP FB Commerce. When you add a theme to the ‘wp-content/themes’ and select it from the Settings -> WP FB Commerce, it will be displayed instead of your default theme when your site is viewed from within Facebook.

How does WordPress know to display the Facebook theme?

When a visitor first accesses the Facebook Page Tab containing your storefront, the query string at the end of the URL tells WordPress to display the Facebook theme. As the visitor continues to navigate through the product catalog, a PHP session variable tells WordPress to continue to display content with the Facebook theme.

Note: If the visitor subsequently navigates to your external website, this session variable can cause the website to be displayed within this alternate theme. However, this should only be momentary — a JavaScript routine detects that the site is no longer being viewed within the Facebook iframe and redirects with a parameter that terminates the session, causing your site to be viewed within its normal theme.

What is the to-do list for this plugin?

  • Improve display of shopping cart contents after user clicks the Add to Cart button. Would be good to have something similar to the sliding cart effect used in the WP e-Commerce sidebar widget. However, the Facebook layout doesn’t leave room for a sidebar.
  • Better AJAX / JavaScript effects for product display and checkout. Need a better way of showing that items have been added to cart. JavaScript for ‘fancy_notifications’ doesn’t seem to be working properly.
  • A way of giving special discounts to users who come through the Facebook channel.
  • The ability to add an additional discount, or display special offers, for people who have “Liked” the merchant’s Facebook page. (Currently, this status is detected and stored in the session variable $_SESSION[“like”] but the variable is not being used to affect product display or pricing.)
  • A hacked version of the thickbox JavaScript is provided — altered to address certain positioning issues when the lightbox is displayed within an iFrame. Would appreciate help from anyone who can come up with a better solution.

Screenshots

  1. A product listing embedded in a Facebook business page.

Changelog

0.1

This is a preliminary test release. Shopping and checkout functions should function much the same as they would on an independent website. However, the plugin needs further testing with WP e-Commerce options.

Categories
Facebook Tab manager WordPress

Facebook Tab Manager 2.8.5 – Tweaks to CSS and Reveal Tab Setup

The latest release of Facebook Tab Manager includes tweaks to the default CSS and handling of custom CSS. I also updated the Reveal Tab Setup Utility.

From the changelog:

  • CSS changes to prevent display of scroll bars, even when too-wide content such as a large image is included (width set on body, with overflow hidden)
  • Changed the way custom CSS is loaded into template. Should perform better.
  • Reveal Tab Setup utility now displays 10 most recent combinations of Fan / Non-fan pages and corresponding URLs.
My intent with the changes to the Reveal Tab Setup utility was to make it more obvious how the URLs generated by the tool related to the content that would be displayed:
Reveal Tab Setup Utility
Reveal Tab Setup Utility
Categories
Facebook Tab manager Web Development WordPress

How To Use Contact Form 7 with Facebook Tab Manager

One of the more useful features of Facebook Tab Manager for WordPress is that you can use it conjunction with other plugins to embed their functionality in a Facebook page tab. I’ve particularly gotten a number of requests for guidance on how to use Facebook Tab Manager with Contact Form 7, a popular forms management plugin.

You can do this by including a Contact Form 7 shortcode, which looks something like this: [contact-form 1 “Contact form 1”]

That code is generated by the administrator’s screen for the plugin. I’m not going to cover that in detail, but this utility allows you to lay out your form and the email notice you will get when someone completes it. You then copy and paste the corresponding shortcode into your page or post — in this case, into an fbtab post.

Here, I’m going to walk through an example of how to display a form only to page fans, while also including the JavaScript and CSS needed for Contact Form 7’s AJAX functions.. You could make this the landing page shown to newcomers, with a message asking them to click the Like button. Once they do so, Facebook Tab Manager detects that this person is now a fan of the page and displays the fan-only content, which includes the form. Perhaps once the person becomes a fan, you give them the option of filling out the form to enter a contest or get some special offer. The business scenario is up to you.

You can see the live example on the Carr Communications Facebook Page. Here is how it appears in the WordPress editor, with the contact form shortcode wrapped inside an fblike shortcode with a like=”1″ parameter to indicate it should only be shown to fans. An alternate bit of content is designated to be displayed to non-fans.

Shortcodes to Display Form to Page Fans

To get the styles and scripts for Contact Form 7 included properly, I need to let WordPress output the wp_head and wp_footer actions just as it would on a regular web page. The tricky part of this is deactivating functions that don’t make sense in a Facebook context. On my website, I have to be careful to turn off a function of my site’s theme that outputs a custom background image, a plugin function that outputs social media icons for my blog, and a few other things. The exact list of tweaks you will need to make varies from site to site, depending on the theme and plugin you have installed, so this is just an example – be prepared to experiment.

Checkbox options:

  • NO -Open Links / Post Forms to New Window
  • YES – Template should execute theme/plugin code in HTML head – wp_head() command
  • YES – Template should execute theme/plugin code in page footer – wp_footer()

Click the Show Advanced button and check off the plugin and theme action/filter functions you want to exclude.

the_content filters to exclude

  • sociable_display_hook

wp_head actions to exclude

  • _custom_background_cb

wp_footer actions to exclude

  • dsq_output_footer_comment_js
  • wp_admin_bar_render
  • stats_footer

Note: Make sure you have the latest release. While preparing this example, I found errors in the code for excluding wp_head and wp_footer action functions. This was fixed in version 2.8.3. Version 2.8.4 also fixed an issue with the Reveal Tab Setup utility and works better with the alternate approach below.

Using the Reveal Tab Utility

Facebook Tab Manager also includes a Reveal Tab Setup utility for designating alternate posts to be displayed to fans versus newcomers. To make this example with that approach, you would create one fbtab post containing the shortcode for the form, and check all the same boxes I explained in the previous example. You would then create a second post telling people why they should register to get access to your wonderful form.

In the Reveal Tab Setup utility, your choices look something like this:

Reveal Tab Setup for a Form
Reveal Tab Setup for a Form

You can see a live example on my business page.

In version 2.8.4, I tweaked the way the special url generated by the Reveal Tab Setup utility is processed by WordPress, making it redirect to the permalink for fans of the page. This was necessary to make it work properly with Contact Form 7, which was otherwise confused by the non-standard URL.

Categories
Facebook Tab manager WordPress

Facebook Tab Manager for WordPress 2.8, Fix for Nesting of Shortcodes

Version 2.8 of the Facebook Tab Manager for WordPress has just been released. It fixes one important error with the handling of the included shortcodes for conditional display of content based on whether someone has liked your Facebook page. Something like the example below for displaying a form created with Gravity Forms only to page fans should now work.

[fbtab like=”1″ ]Thanks for liking us! Here is the entry form:[gravityform id=3]
[/fbtab]

I had misunderstood this documentation and thought that nesting of shortcodes was automatically supported, but it turned out I needed to include a do_shortcode call in my shortcode function. Thanks to Jason Lane for pointing out the error.

Categories
Facebook Tab manager WordPress

Reveal Tab Setup in Facebook Tab Manager WordPress Plugin version 2.7.3

One of the things people want to do with Facebook Tab Manager is create a “reveal tab” effect where new visitors see one message, urging the people to click the LIKE button, and page fans see another message, perhaps displaying fan-only special offers or other content.

I’ve already introduced several techniques based on the fbtab and fblike shortcodes. These have the advantage of allowing you to mix and match blocks of content that will be displayed to everyone with other content that is conditional based on fan status.

The new technique I’m introducing with version 2.7.3 is based on designating alternate posts to be displayed based on page fan status, which are referenced using a special URL that includes a query parameter like ?fbreveal=100,200 where 100 is the ID of a post to be shown to the new people and 200 is the post for fans.

The new Reveal Tab Setup menu screen contains a utility that simplifies the process of constructing the URL.

Reveal Tab Setup screen

One potential advantage of this approach is performance. Instead of loading a base post and then looking up additional content based on shortcode parameters, this method avoids some of the default WordPress processing and cuts straight to loading the fan or non-fan content (translation for programmers: the action for detecting a URL in this format is called on “init” rather than “template_redirect”).

Creating alternate posts for fans and non-fans may also be cleaner than marking up alternate blocks of content with the fblike shortcode. I think both techniques are valid, but I’d be interested in your feedback on this variation.

Categories
Facebook Tab manager WordPress

Re-purpose a WordPress Post or Page with Facebook Tab Manager

I designed Facebook Tab Manager to let you create and update content for your Facebook business page using WordPress, but it’s also possible to re-purpose an existing blog post or page and display it within Facebook.

You do this by adding the query parameter ?fb=tab to the end of the URL, for example:

http://www.carrcommunications.com/2011/05/re-purpose-a-wordpress-post-or-page-with-facebook-tab-manager/?fb=tab&resize=1

This causes the content to be displayed in the fbtab template, using the default styles (Facebook fonts etc.). You would then plug this URL into the Facebook Developers utility the same way you would with any other Facebook Tab Manager post.

I used the resize parameter to make the iFrame for the tab content resize for content taller than 800 pixels to avoid the display of a vertical scroll bar. Note that this doesn’t do anything to avoid problems with content that is wider than the 540 pixels Facebook provides for tab content. So if your existing page or post includes a 550-pixel wide image, it’s not going to fit neatly into the iFrame.

The optional query parameters you can use are:

  • resize=1 (invoke the resizing JavaScript)
  • new=1 (links should open in a new window)
  • head=1 (execute wp_head)
  • footer=1 (execute wp_footer)
  • minfilters=1 (added in version 2.7.2, turns off all but essential filters on the_content)

Note that you could also use that last parameter in conjunction with a Facebook Tab Manager post as an alternative to selectively turning off filters on the_content. Useful if you’re trying to get rid of the output of plugins like Sociable that add icons and links to the end of each post.

Example:

http://www.carrcommunications.com/fbtab/test-6/?minfilters=1

Categories
Facebook Tab manager WordPress

Facebook Tab Manager 2.6.8 Includes New Reveal Tab Option

The latest update to Facebook Tab Manager for WordPress includes a new option for doing a reveal tab or otherwise setting content that will only be displayed to people who have liked your page, with alternate content for people who have not yet done so.

You can still use the fbtab shortcode with the like=”1″ or like=”0″ attributes and wrap it around a block of content.

Alternately, you can use the like attribute in combination with getpostid, which may be cleaner. You can create two fbtab posts and pull them into a single post that includes the like/unlike code. You can also include a page or blog post this way.

[fbtab getpostid="5" like="1"]
[fbtab getpostid="1337" like="0"]

This would be displayed as the contents of post #5 shown to all the current fans. In my test, post #5 was an existing page. Post #1337 is an fbtab post containing a graphic, essentially an ad for people to like the page. As a marketing gambit, the idea is usually to tell people why they should like the page and then show them some super special content once they do so. You can see the results at the bottom of my Like/Not Like Demo page

I find shortcodes very flexible, but I have run into situations where having them mixed in with elaborately formatted content can lead to code getting scrambled.

Categories
Facebook Tab manager Web Development WordPress

Facebook Tab Manager Setup Shortcut

One of the things I’ve enjoyed about promoting this plugin is seeing how people use it, often in ways I wouldn’t have thought of. The other day, I stumbled across a blog post by Michael Brandvold who showed me a different way of adding a page tab that uses Facebook Tab Manager but shortcuts some of the steps related to futzing with the Facebook Developer app.

He suggests using one of the freely available Facebook applications that have been created to help page owners manage their tabs from within Facebook. He recommended the Static HTML app, which mimics some of the functionality of the late, lamented Static FBML app that Facebook no longer makes available for new development. I also tested his technique with the HyperArts TabPress app (which, despite the name, has nothing to do with WordPress) and it worked equally well.

These tools let you paste in a block of HTML code that you want displayed, and you can also then edit and update that code from within Facebook. But what if you would rather take advantage of WordPress and its rich text editor?

Brandvold’s hack is to paste in a snippet of redirection code that points to your Facebook Tab Manager content, something like this:

<html><head><meta http-equiv='Refresh'
content='0; url=https://www.carrcommunications.com/fbtab/welcome-to-carr-communications/' /></head></html>

So instead of a whole page of HTML, you include just enough to redirect to the content you’re managing in WordPress.

There are a few tradeoffs to consider:

  • The page might load slightly slower because the viewer’s browser has to follow that redirect.
  • You can’t customize the icon that appears next to the tab name. You get the ones provided by the creators of the Static HTML and TabPress apps. TabPress also adds a little promo for itself at the bottom of your tab content (although HyperArts will sell you a “white label version” if it’s important enough to you).
  • You should probably have the redirect point to an https (SSL encrypted) web address to avoid triggering browser security warnings, particularly in Internet Explorer.
Categories
Facebook Tab manager Social Media Web Development WordPress

Facebook Tab Manager for WordPress – Latest Updates

Here is a rundown on the latest updates to Facebook Tab Manager. More explanation after the bullet points. I will be doing a webinar on the use of the plugin Thursday April 14, 2011 at 7 pm ET (www.anymeeting.com/davidfcarr), and a recording will be available if I can figure out how to push the right buttons.

Changes in version 2.6.2 2.6.4

  • Added [fblike] shortcode as an alias to [fbtab nodecode="1"]. Recommended for situations where you are wrapping a block of text and image content inside a shortcode that indicates whether it should only be shown to people who have not yet liked, or who have liked your page. Example [fblike like="0"]CONTENT TO SHOW TO NEW VISITORS[/fblike] [fblike like="1"]FAN-ONLY CONTENT[/fblike]
  • To display an existing page in the fbtab template, you can add the query string ?fb=tab to the end of the page url. You can also use resize=1 to invoke the resizing JavaScript. Example:http://www.carrcommunications.com/contact/davids-resume/?fb=tab&resize=1
  • Update: version 2.6.4 also lets you set query parameters new=1 (links should open in a new window) head=1 (execute wp_head) and footer=1 (execute wp_footer). I think that’s about as fancy as I’d want to make it from options you can pass through the url, but I came across cases where these would be useful in my own experiments.
  • Users who don’t like my template can now specify their own should be used instead. Only recommended for advanced users with their own plugin/template development skills.
  • Better conformance with WordPress coding standards.

Here is the background. I originally set up the fbtab shortcode to cover a couple of different scenarios, one of which was a technique for including inline JavaScript like one of the snippets you might get from the Facebook Social Plugins page. The idea was to let users paste in the script snippet in the WordPress editor’s visual mode as if you were entering a code sample for display rather than execution. I’d then let the shortcode function decode any HTML entities transformations added by the editor.

The like=”0″ and like=”1″ attributes came later. It worked fine if what you wanted to include or exclude based on whether the visitor had liked your page was a JavaScript snippet or a blog listing generated using the query parameter. But what if you wanted to just include a block of content between the tags? You might have content that ought to be encoded as HTML entities, so the decode routine wouldn’t be appropriate for that and might cause problems. At some point, I added support for a decode=”0″ parameter to indicate the HTML decode should not be applied.

In an attempt to clean this up a little, I’ve added fblike as another shortcode tag you can use with all the same parameters, but it’s specifically intended to be used around snippets of regular HTML content.

Another request I got was for an easy way to turn an existing post into a Facebook tab. So now you can just add ?fb=tab as a query string added to the url for a WordPress post or page, and it will be displayed in the fbtab template. This essentially strips away the regular WordPress navigation and substitutes uses a stylesheet with smaller Facebook body and headline fonts. You can use ?fb=tab&resize=1 to get the template to include the resize JavaScript snippet.

Note that pages that include fancy layouts or large images may not translate neatly into content suitable for a Facebook page tab. But in some cases, I can see this as a reasonable way to have one piece of content you can manage through WordPress that appears on both your website and your Facebook page.

Finally, several people have found reasons why they wanted to make their own hacks to the template file. To allow them to do that without breaking compatibility with future upgrades to the plugin, I’ve added the ability to specify a file path to your own plugin that should be used as a substitute for the default.