Facebook Tab Manager provides support for two shortcodes that can be used to insert or filter content,
A WordPress shortcode is a placeholder for content that will be output dynamically when the page is displayed. This is often used for purposes such as outputting a data entry form, where you wouldn’t want to edit the form HTML in the WordPress editor.
When shortcodes are wrapped around a block of content, with a closing tag such as
[/fblike] at the end, the content inside the shortcode tags is passed to a filter function associated with that shortcode. The function can add to or modify that content. Facebook Tab Manager
[fblike] shortcode uses this for conditional display of content based on whether the viewer has “Liked” your page.
Conditional Display of Content with [fblike]
Facebook Tab Manager uses
[fblike] for condiditional display of blocks of content, based on whether or not the person viewing the page has become a “fan” / subscribed to posts from that page by clicking the Like button. You do this using the fblike shortcode with
like="0" as attributes on the shortcode. One advantage of using shortcodes for conditional content is your post can also include content that is displayed to all viewers regardless of their “fan” status. If you don’t like dealing with code in the body of your posts, consider using the Reveal Tab Setup utility instead.
The shortcode format is
[fblike like="0"]CONTENT TO SHOW TO NEW VISITORS[/fblike] [fblike like="1"]FAN-ONLY CONTENT[/fblike]. You can include multiple paragraphs, images, and other content, wrapped inside an
[fblike] tag — just be sure to include the
[/fblike] code at the end.
It is also possible to include other shortcodes, such as the one to output forms from the Contact Form 7 plugin, wrapped inside the [fblike] shortcode tag. (See tutorial on using Contact Form 7 with Facebook Tab Manager).
- To include blog post or page content, you can use
[fbtab query="QUERY-STRING"]where the query string is something like category_name=facebook-tab-manager — see the documentation for the query_posts function for possible values. You can also use a format attribute of
- You can also use
like="0"as an attribute on the
[fbtab]shortcode to determine whether
[fbtab]content should be shown or hidden.
See the Tab Manager tab at http://www.facebook.com/carrcomm for an example using
[fbtab query="category_name=facebook-tab-manager" format="excerpt"]
Here is what it looks like in the editor:
This is an
[fbtab] that executes a query.
Here are some common queries you might use:
[fbtab query="posts_per_page=20" format="headline"] – the 20 most recent posts from your blog, headlines only.
[fbtab query="posts_per_page=10&cat=1,2,3" format="headline"] – the 10 most recent posts from categories 1, 2, and 3
[fbtab query="posts_per_page=10&cat=-3" format="headline"] – the 10 most recent posts, excluding category 3.
You can also include an entire post using getpostid as an attribute on fbtab. When used in combination with the like attribute, this provides yet another way of doing conditional content:
[fbtab getpostid="5" like="1"]
[fbtab getpostid="1337" like="0"]
When composing posts that include conditional content of custom queries, continue using a preloader effect to ensure the user sees a visual indication that the website is loading content even if these routines take a few seconds to run.