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.

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]

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.

Web Development

Video: Big Data and Social Analytics (Toastmasters Prep for Enterprise 2.0)

I presented this speech to Toastmasters Club Awesome in Coral Springs as a way of practicing for the Enterprise 2.0 conference in Boston, which is coming up the week of June 20. I’ll be moderating a panel on Big Data and Social Analytics, and the introduction will go something like this:

By the way, the critique I got from my fellow Toastmasters was that I did too many random things with my hands and ought to be more deliberate with my body language. But they seemed to think I sounded like I knew what I was talking about.

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.

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:

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.


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.

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=' /></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.
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 (, 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:
  • 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.

Facebook Tab manager Web Development

Facebook Reveal Tab Created with Facebook Tab Manager, jQuery

This is a work in progress for a client of mine, showing how to create a Facebook reveal tab – a page tab that reveals more information once a visitor has clicked the “Like” button – using Facebook Tab Manager.

Because this is for an optometry practice, I had Beth Anne mock up an eye chart illustration that comes into focus when you click the button. Then, once we’ve gotten our point across, the eye chart vanishes using a jQuery animation effect, revealing the practice’s current special offer. This is still under development, so I’d appreciate your help getting a critical mass of likes on the Marciano Family Optometric page (even if you unlike it later).

Here is how it works:

Invitation to Like the Page
Eye Chart Comes Into Focus
jQuery hide animation effect begins
Special offer revealed

The effect is based on two blocks of content, tagged using these shortcode patterns:

[fbtab like=”0″]INVITE “LIKE” CONTENT[/fbtab]

[fbtab like=”1″]FAN ONLY CONTENT[/fbtab]

As part of the fan only content, I wrapped the image in div tag with “eyechart” as the ID. and included this JavaScript:

<script type=’text/javascript’ src=’http://YOURDOMAINHERE/wp-includes/js/jquery/jquery.js’></script><script>jQuery(document).ready(function($) {$(‘#eyechart’).delay(2000).slideUp(600);});</script>

One of the things the fbtab shortcode lets you do is paste a block of JavaScript into the WordPress editor in its visual mode. The function invoked by the shortcode fixes the entity references etc. introduced by the TinyMCE editor and transforms it back into executable JavaScript. So it’s a technique for including inline JavaScript. In this case, I’m not having FBTab manager output the wp_head action code content, so my inline JavaScript has to load the jQuery library first before invoking the animation functions.

As I say, it’s a work in progress, so I’d welcome your feedback.

Web Development

Webinar on Facebook Tab Manager for WordPress

I am hosting a webinar Thursday April, 14 2011 at 7 pm ET on the use of the Facebook Tab Manager WordPress plugin I created, which allows a website operator to include blog posts and other content on a Facebook page for a business, campaign, or other organization. For an example, see the “Clip File” tab on

Thursday April, 14 2011 at 7 pm ET, details:

I will present a tutorial and answer questions.

I also want to hear from those of you who have done interesting things with Facebook Tab Manager.

Background: Facebook Tab Manager is a WordPress plugin that lets you incorporate blog and website content into a Facebook page for a business or organization. You can create posts specifically for Facebook and designate content that will only be shown to people who Like your page