Facebook Open Graph protocol allows you to share your blog content not only with your readers, but their Facebook friends as well. The best part is – whenever someone liked your content(s), it will be published on their Facebook profile. But that’s not all, Open Graph allows you to explore more interesting ways to interact and engage with your readers. Ultimately – if this is done right – it builds up your brand and increases your site’s traffic. Ready? Let’s fire up the browser and your favourite code editor. Full guide after jump. Step 1: Create a facebook AppWe’ll need an Application ID and to get that, you’ll need to create a Facebook App. If you already have a one, move on to step 2.Creating an application is easy, here’s what you do:
Step 2: Replace TagOpen up your theme’s header file (header.php) in your favorite editor. Always keep a backup copy just in case anything goes wrong.Look for this following line of code, or one that starts with > Replace it with: Keep header.php open, we are going to need it for the 3rd step. Step 3: Insert OG tagsPaste the following code right after tag, or before tag.Here are some of the the values you’ll need to alter:
Step 3a – When "wp_get_attachment_thumb_url" FailWhenwp_get_attachment_thumb_url() failed to work, you are likely going to a content attribute with no value, like what’s shown below:A simple workaround will be to replace Line 12 with the following code: Next, open up functions.php and insert the following code: function catch_that_image() { global $post, $posts; $first_img = ''; ob_start(); ob_end_clean(); $output = preg_match_all('/This replacement code attempts to use a function call catch_that_image() to grab and output the URL of the first image it comes to encounter. Replace line 10 with URL to a default image if the function fails to find its first image.Step 4: Insert Facebook Javascript SDKThe following Javascript gives you to access all of the features of the Graph API and Dialogs. It also allows you to integrate Facebook social plugins like the Like button, Facepile, Recommendations, etc with ease.Place it in header.php, right after
Replace your_fb_app_id in Line 4 with Application ID from Step 1 earlier. Step 5: Let’s test it!We are done integrating Facebook Open Graph to the WordPress blog. Let’s give it a couple of test to make sure we’ve done things correctly.Test 1: View source codeTake a look at the source codes of one of the blog post, you should have something like this:Check the properties and its values, make sure they are correct. Test 2: Install a Like BoxIf you haven’t install a Facebook Like Button, then it’s probably time to get one. Place the following code anywhere (preferably before content or after content) inside single.php:Next, get a friend to Like it. You should see something similar appearing in his Facebook profile: |
There are very large image Collection of Super Star Singer and Very famous singer in Sri Lanka, Nadini Premadasa with very good resolution. Newly and Previous Hot and Cute images via this site. Nadini Premadasa is a very famous Singer & TV presenter in Sri Lanka.She was born on 19th December & her school was Musaeus College. Her first audio "Sapu Kusume" & video "Madesha Balannai" was released in 2007.She has released a her first music album is out now.There are large image collection with her previous and newly released hot and cute images. The year 2007 is the revolutionary year of Nadini Premadasa. She unleashed her potential by entering to the “Sirasa Super Star Singing Competition”. This is the most competitive reality singing program in Sri Lanka. She had the courage and talent to compete with the best singing personalities in the country. As a result, she ended becoming an attractive and talented female singer.(via nadinilive.com ) She is very cut
Comments
Post a Comment