Latest Blog Posts »
Add a form to Facebook
In this post I will show you how to add a custom tab to your Facebook Page using the Facebook Static FBML application.
First, add the Static FBML Application to your page. The Facebook Static FBML application gives you the ability to add advanced functionality to your Facebook Fan Page. This application will add a box to your Page in which you can render HTML or FBML (Facebook Markup Language) for enhanced Page customization. Installing the app is easy, but actually getting to the area where you edit can be a little tricky. When you add the app it will give you choices of which Page or Pages you want to add it to.
Second, create your opt-in tab. After you have added the app, head to your Page and click on “Edit Page”. Locate FBML in your list of applications and click on the pencil icon to edit. In “Box Title” you can give the tab a name like “Email Signup” or “Newsletter”. In the “FBML” section, simply paste your form code in. You can style your form and imagery to give the Box some look and feel, similar to the car image I added in the example above. One key customization I added to our code was <form method=”post” action=”http://url.com” TARGET=”_blank”> at the end of the url to open a new browser tab or a window so the user doesn’t lose their place on Facebook.
Last, add the new tab to the Facebook navigation. Where it shows “FBML” on the “Add a New Tab” drop down, will be the custom name you gave the new Box. If you are running out of room with your Tabs, you may need to scoot some things over to give your new Tab some visibility.
This App will also live on your “Boxes” tab in a condensed version, unless you go back to Edit Page > FBML Settings > Application Settings and remove it from the Box and just leave the Tab (which I recommend).
One last thing, if you have trouble getting the Box to appear as some have noted, simply “Add Another Box” and copy the exact same code in.
Enjoy! Please comment if this helped you!
Fix pagination when using query_posts() in WordPress
If you are a WordPress developer, or user, there may come a time where you will want to use the WordPress query_posts() function to retrieve your blog posts rather than the standard loop. For example, I wanted to exlude a category that contains all of my Twitter Tweets (I know, but run with in). So I put in the following code:
if (is_home()) {
query_posts(”cat=-52″);
}
The problem is that this also messed up the pagination of the page. To fix this issue I added this code:
if (is_home()) {
$paged = (get_query_var(’paged’)) ? get_query_var(’paged’) : 1;
query_posts(”cat=-52&paged=$paged”);
}
Let me explain what I’ve added, and why.
query_posts() is a powerful function, but in this situation it has a flaw: it overrides nearly everything in the standard posts object query, including what the paged offset is. To get proper pagination with query_posts() we need to recreate it through the ‘paged’ parameter or query. Best way to do this is to ask WordPress for the “page” we happen to be on, and use that as our ‘paged’ value.
The $paged = line above uses what’s called a ternary operator to test whether the ‘paged’ query variable is available. If it is, $paged receives its value. If it isn’t, we assume we’re on the first page and assign it ‘1′. Then we tell query_posts() what page we’re on with the addition of &paged=$paged.
Shazam! Fixed. Let me know if this helped you as well! Comments are always welcomed!















