Webmaster Forum

Go Back   Webmaster Forum > Web Development > Coding Forum

Coding Forum Problems with your code? Discuss coding issues, including JavaScript, PHP & MySQL, HTML & CSS, Flash & ActionScript, and more.


Closed Thread
 
LinkBack Thread Tools Display Modes
Share |
  #1 (permalink)  
Old 06-06-2011, 01:09 AM
Banned
Latest Blog:
None

 
Join Date: 07-07-09
Location: Around the biggest network in the world
Posts: 60
iTrader: 0 / 0%
Facebook like button won't stay "liked"

Hi, i'm trying to understand something here:
I generated a facebook like+send button and placed it on the place I want to show on WP template page, but when I press the button it doesn't stay, it reverts back

code I used

Code:
<div id="fb-root"></div><script src="http://connect.facebook.net/pt_PT/all.js#appId=171704749557556&amp;xfbml=1"></script><fb:like href="" send="true" layout="button_count" width="100" show_faces="false" font=""></fb:like>
any idea why this happens

page is fotografiasdeangola.com/en/fotografias-de-lunda-sul

(sorry to post the page, is just so you can see what Im talking about)

Last edited by DSeyir; 06-06-2011 at 01:13 AM.
 

Advertisement

Advertisement

  #2 (permalink)  
Old 06-07-2011, 12:04 AM
Junior Member
 
Join Date: 03-28-11
Posts: 28
iTrader: 0 / 0%
I think you miss your site url

<div id="fb-root"></div><script src="http://connect.facebook.net/pt_PT/all.js#appId=171704749557556&amp;xfbml=1"></script><fb:like href="http://www.yoursite.com" send="true" layout="button_count" width="100" show_faces="false" font=""></fb:like>

Change http://www.yoursite.com with your site url hope it will work
 
  #3 (permalink)  
Old 06-07-2011, 01:05 AM
Banned
Latest Blog:
None

 
Join Date: 07-07-09
Location: Around the biggest network in the world
Posts: 60
iTrader: 0 / 0%
nope, if you do that you cannot use it in a dynamic page, if you leave empty it gets the page url by default
 
  #4 (permalink)  
Old 06-07-2011, 01:30 AM
nemrod's Avatar
v7n Mentor
 
Join Date: 12-21-10
Location: Sweden
Posts: 463
iTrader: 0 / 0%
I would just remove the attribute completely if I wanted it to get the current page URL. On the other hand I would probably use PHP to get the URL I wanted to be liked dynamically based on page either way instead of relying on such things.
 
  #5 (permalink)  
Old 06-07-2011, 01:54 AM
Banned
Latest Blog:
None

 
Join Date: 07-07-09
Location: Around the biggest network in the world
Posts: 60
iTrader: 0 / 0%
hey nemrod, I still owe you the vodka bottle, hahaha

look, I have this on my header.php

PHP Code:
<meta property="fb:admins" content="*****************"/>
<meta property="og:type" content="article" />
<?php if(is_home()) {
?><meta property="og:title" content="Fotografias de Angola" /><?php
} else {
?><meta property="og:title" content="<?php the_title_attribute$args ); ?>" /><?php
}
?>
<?php 
if (is_home())
    echo 
'<meta property="og:url" content="http://fotografiasdeangola.com/" />';
    else echo 
'<meta property="og:url" content="'.get_permalink().'" />';
?>

<?php wp_head(); ?>
and I load the script using
Code:
<script> window.fbAsyncInit = function() { FB.init({appId: '**************', status: true, cookie: true, xfbml: true}); }; (function() { var e = document.createElement('script'); e.async = true; e.src = document.location.protocol + '//connect.facebook.net/pt_PT/all.js'; document.getElementById('fb-root').appendChild(e); }()); </script>
but even with this the like button doesn't "stay", the only way I found to it to stay is by using

Code:
<fb:like href="<?php the_permalink() ?>" send="true" layout="button_count" width="100" show_faces="false" font=""></fb:like>
but like this the post in facebook looks like crap, I mean it parses the url with "http://..."
 
  #6 (permalink)  
Old 06-07-2011, 02:20 AM
nemrod's Avatar
v7n Mentor
 
Join Date: 12-21-10
Location: Sweden
Posts: 463
iTrader: 0 / 0%
I'm using the permalink on my blog and it shows up just fine on Facebook.



That's me liking this post.

I'm using the iframe code though, more precisely this here:
HTML Code:
<iframe src="http://www.facebook.com/plugins/like.php?app_id=202937996418289&amp;href=<?php echo urlencode(get_permalink($post->ID)); ?>&amp;send=false&amp;layout=button_count&amp;width=80&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:80px; height:21px;" allowTransparency="true"></iframe>
 
  #7 (permalink)  
Old 06-07-2011, 04:30 AM
Banned
Latest Blog:
None

 
Join Date: 07-07-09
Location: Around the biggest network in the world
Posts: 60
iTrader: 0 / 0%
well, I'm trying to avoid iframes, specially because it's harder to position them where I want on the site
 
  #8 (permalink)  
Old 06-07-2011, 04:32 AM
nemrod's Avatar
v7n Mentor
 
Join Date: 12-21-10
Location: Sweden
Posts: 463
iTrader: 0 / 0%
You do realise that the code you're using is replaced with an iframe through the JS you're including, right? Take a look at the generated source code (ctrl+shift+j in Chrome).
 
  #9 (permalink)  
Old 06-07-2011, 10:12 AM
Banned
Latest Blog:
None

 
Join Date: 07-07-09
Location: Around the biggest network in the world
Posts: 60
iTrader: 0 / 0%
great, I didn't realized that

anyway, I prefer to load the script on one side and so I can use the XFBML around the website, but I guess that's the not the issue regarding if it stays "liked" or not.
 
  #10 (permalink)  
Old 06-07-2011, 10:32 AM
Banned
Latest Blog:
None

 
Join Date: 07-07-09
Location: Around the biggest network in the world
Posts: 60
iTrader: 0 / 0%
OK, it's working now.
and I just realized that facebook tells you to load the script on one side so that you may use the xfbml and the open graph, and when you generate the a like button it gives the option , the iframe and the xfb.., and in the xfb.. comes the script again.

I guess I'm missing something
 
Go Back   Webmaster Forum > Web Development > Coding Forum

Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using the facebook "like" button byrnebm Social Network Marketing 3 01-28-2011 12:29 AM
Add the new Facebook "Like" button to your website mporgsoft Social Network Marketing 1 04-22-2010 08:38 PM
<input type="image" src="login_button.png" name="login" /> Error in IE !! HELP 2939195631902 Coding Forum 9 02-20-2009 08:43 AM


V7N Network
Get exposure! V7N I Love Photography V7N SEO Blog V7N Directory


All times are GMT -7. The time now is 09:24 PM.
Powered by vBulletin
Copyright 2000-2014 Jelsoft Enterprises Limited.
Copyright © 2003 - 2014 Escalate Media




Search Engine Optimization by vBSEO 3.6.0 RC 2 ©2011, Crawlability, Inc.