B2B Marketing Insights by Ironpaper

How To PHP To Create A Facebook Like Button For A Dynamic Wordpress Post Page URL

Written by Ironpaper | June 19, 2010

The Facebook Like Button is a very useful and rapidly popular social web marketing tool that can be applied to websites and webpages. By default, the Facebook's Like Button form will recommend a specific web page that is hard coded into the code snippet (which can be generated by Facebook's Like Button form).

Typepad users now have the Facebook Like Button embedded as a core application, which has helped to generate a lot of traffic to blog websites based on a recent report by Typepad.

It is possible to publish a Facebook Like Button that references a dynamic Wordpress Post page rather than just making recommendations to the website in general.

How to reference the URL for a single Wordpress post

On the Wordpress post page template, below the snippet:

<div <?php post_class() ?> id="post-<?php the_ID(); ?>">, you can print the page URL with the following code: &lt;?php the_permalink(); ?&gt;

The above code snippet, will print the URL of that post page.