Custom title, summary is not working in facebook sharer - facebook

I had links in my website which were working fine but I noticed that these are not working now.
eg : http://www.facebook.com/sharer/sharer.php?s=100&p[url]=http://www.otlcampaign.org/blog/2013/02/04/inconvenient-truth-education-reform&p[images][0]=http://www.otlcampaign.org/sites/default/files/journey-for-justice-mlk-memorial.jpg&p[title]=The+Inconvenient+Truth+of+Education+'Reform'!&p[summary]=Recent+events+have+revealed+how+market-driven+education+policies,+deceivingly+labeled+as+%22reform,%22+are+revealing+their+truly+destructive+effects+on+the+streets+and+in+the+corridors+of+government:
this link was working fine before but its not taking custom title , summary etc. Please help me to resolve this problem.
I'm not using meta tags because there are lot of share buttons which have different title, description, image urls.
I have already gone through existing question on this site but those solutions are obselete. eg Facebook Share doesn't show my description or my thumbnail
Any suggestions please.

I'm not sure if you're comfortable with using PHP, but have you tried the following?
<?php
$title=urlencode('Title');
$url=urlencode('http://www.facebook.com/yourfanpage'); /* Note Personal FB Pages will not work */
$summary=urlencode('Custom message');
$image=urlencode('http://www.yourdomain.com/facebookshare/images/customthumbnail.jpg');
?>
<a onClick="window.open('http://www.facebook.com/sharer.php?s=100&p[title]=<?php echo $title;?>&p[summary]=<?php echo $summary;?>&p[url]=<?php echo $url; ?>&&p[images][0]=<?php echo $image;?>', 'sharer', 'toolbar=0,status=0,width=548,height=325');" target="_parent" href="javascript: void(0)">
Share our Facebook page!
</a>
From your example, also, I noticed that one of the issues might be the ampersands. You have 100& instead of 100& You will need to double check all of the links for these and the spaces, etc.

Related

Creating a dynamic Facebook share button

I am stuck with this one...
I have a website that plays music. The page updates automatically to display the current song being played and the image of the artist. The website also allows visitors to request songs. What I want to do is allow users to then share their request on Facebook, so I have added the code below.
Initially, when you pressed the Facebook button, it would pop up iwth a box which contained all the correct info (song, artist, image, etc), but would not post correctly to Facebook (the dynamic info such as title and image would be missing). Now, recently, it doesn't even populate the pop up correctly.
I'm stuck and cannot figure out how to get this to work correctly, can anyone help me?
Thanks.
<a class="facebook" target="_blank" onclick="return !window.open(this.href, 'Facebook', 'width=640,height=300')" href="http://www.facebook.com/sharer.php?s=100&p[title]=I'm listening to <?php echo $currentSong->title . ' by ' . $currentSong->artist; ?>&p[summary]=Join me and listen right now or request your own song&p[url]=http://www.mydomain.com&p[images[0]=<?php echo $largeimg; ?>"><img src="http://www.mydomain.com/new/images/facebook.png" width="32" height="32" border="0" style="padding-top:5px; padding-right:4px "></a>
Actually, you should only add the URL as parameter (url encoded) to the sharer.php:
<img ... />
It automatically takes the Open Graph data from the shared URL, see this page: http://ogp.me/
I assume all the other parameters are deprecated, at least it did not work for me some months ago. The only thing you could try is to encode all data with the PHP function "urlencode" - but i would suggest using the correct way and implement Open Graph correctly. That way you can even just take the URL, put it on Facebook manually and it will take the correct data.
If the content is completely dynamic, you should consider using Open Graph Actions: https://developers.facebook.com/docs/opengraph/
Or if that is too complicated, use the FB.ui feed dialog:
https://developers.facebook.com/docs/reference/dialogs/feed/
...but don´t forget to include the JavaScript SDK:
https://developers.facebook.com/docs/javascript/quickstart

In tumblr, show only posts with a certain tag in the home page

In tumblr, is it possible to show only posts with a certain tag in the home page?
If so, how is it done?
I just wrote up the solution to the opposite problem here:
How to hide the posts with a given tag from the homepage.
You can take inspiration from there and implement the opposite. Alternatively, you can simply add a "hidden" tag to each one of the things that you don't want displayed on the homepage.
I know that this topic is quite old, but I figured I'd share what I did for anyone who is still looking for an answer to this problem.
First, paste the following code after the "</title>" in your theme HTML.
<meta name="text:Default Tag" content="" />
Next, right after the "<body>" in your theme's HTML, paste the following:
{block:IndexPage}<script type="text/javascript">
var url = location.href;
if (url == "{BlogURL}") {
window.location = "{BlogURL}tagged/{text:Default Tag}";
}
</script>{/block:IndexPage}
In your theme settings, you should see a box labeled "Default Tag". Put the tag you'd like posts to appear for in that box (without a hashtag) and click save.
Now, if someone visits your blog, it will forward them to the page that shows posts with your specified tag. Of course, this probably isn't the best way of doing it, but it's the best way I could come up with that wouldn't mess up themes.
Another thing I like about this way of doing this, is that you can send someone your blog URL with a "/?" appended to it (e.g. "myblog.tumblr.com/?") and it will show all of your posts.
Using mircealungu's suggestion worked perfectly for me! Here's how I did it:
1. Find the article tag, and add the classname:
class="notfeatured {TagsAsClasses}"
If it already has a classname, add the part in bold above inside the classname quotes. Mine ended up looking like this:
<article id="{PostID}" class="post notfeatured {TagsAsClasses} {PostType}{block:PermalinkPage} {block:Date}not-{/block:Date}page{/block:PermalinkPage}">
2. Find the div tag that precedes the article tag, and add the classname:
class="{block:TagPage} tag_page {/block:TagPage}{block:PermalinkPage}perma_page{/block:PermalinkPage}"
Again, if a class already exists, just add the part in bold above inside the classname quotes. Mine ended up like this:
<div id="posts" class="{block:TagPage} tag_page {/block:TagPage}{block:PermalinkPage}perma_page{/block:PermalinkPage}" >
3. Finally, add this to your CSS:
article.notfeatured {display: none;}
article.featured, .tag_page article.notfeatured, .perma_page article.notfeatured {display: block;}
Now any post tagged as "featured" will display on your home page, but nothing else. So far no issues for me, it works great! You can see it here.
You can also use javascript to reorder the display so you can make the featured posts appear first in a list. The script is very simple:
$('article.featured').prependTo('#posts');
And here is a demo. Just place that inside javascript tags and put it right before the /body tag in your theme. In this case don't use the CSS above, because you don't want to hide the posts. I implemented a .top class for the script and kept the .featured class for the CSS, and I use both the CSS and the script.
Tumblr’s Custom Themes don’t provide such a functionality.
You could use JS or CSS to (visually) hide all posts without a specific tag on the index page, but that way you won’t have the full 10 (or whatever you configured) posts per page anymore.
You could probably use Tumblr’s API to create a list of matching posts (with Javascript) and display that content instead of the default posts (so your custom theme would only contain the script for the index page content). You would have to make sure that the pager still works, though.
Actually, it is possible, but it might not work how you want.
1st. Identify the id of your individual posts (usually something like #post or #entry, lets call yours #entry)
2nd. Replace your opening post div with this:
2nd. Add this bit of css
{block:IndexPage}
#entry (or whatever name it is) {display:none}
.featured {display:inline !important}
{/block:IndexPAge}
3rd. Tag all the posts you want to show on your homepage without quotes as "featured"
This should work, but it will most likely hide all the non "featured" posts on your search page and tag page as well, which you may not want.
If you want your users to be directed to a specific 'splashpage' when they visit your blog, you could always use a jquery redirect script. Hope some of this helped!
Im sorry to say, with their existing theme options as of today, you cannot achieve this without horribly ruining your seo reputation.
I have tried many ways to do this, using tumblr php api and other,
This worked for me: I am using a page outside tumblr and loading the tagged posts via curl php calls.
It can be done via ajax but for SEO reasons I wanted to use php.
Here is the code:
$oath = 'xxx';
$blogName = 'yyy.tumblr.com';
$tag='tagname';
$apiLink = "http://api.tumblr.com/v2/blog/$blogName/posts/?api_key=$oath&tag=$tag";
// Initializing curl
$ch = curl_init( $apiLink );
// Configuring curl options
$options = array(
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => array('Content-type: application/json') ,
);
// Setting curl options
curl_setopt_array( $ch, $options );
// Getting results
$result = curl_exec($ch); // Getting JSON result string
$data = json_decode($result);
$posts = $data->response->posts;
I realise this is old, but I've just had to do it, so here is my solution. At the end of the theme, in the script tags add:
{block:IndexPage}
$( ".the-posts" ).load( "tagged/home .the-posts article" );
{/block:IndexPage}
Where home is the tag you have given the posts you wish to see on the index page. This will basically load the correct articles into the posts div, replacing what it there. See the jquery man page: http://api.jquery.com/load/ for more info.

Adding text to a facebook share pop up (javascript not hardcoded html string)

I am trying to add text to a facebook share link after it pops up. I have looked through the facebook dev site and searched online and the only thing that looked like it might remotely work was adding in meta tags for the Graph API. But I couldn't get them to work or display anything.
Below is the code for the button
<script>
function fbs_click() {
u=location.href;
t='Where is your kind of crowd? Ask StreetPotato';
window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');
return false;
}
</script>
<a rel="nofollow" href="#"
class="fb_share_button social" onclick="return fbs_click()"
target="_blank"
style="text-decoration:none;"
title='Follow us on Facebook'>
<%=image_tag "social/facebook.png", alt:"Follow us on Facebook"%>
</a>
If anyone has any insight or idea how to add in default text, like a hash-tag into the share text box it would be awesome. Thanks for reading.
-Alan
In general, you should not pre-populate any of the Facebook social dialogs that will post on behalf of a user.
See IV.2 of the Platform Policy doc:
"You must not pre-fill any of the fields associated with the following products, unless the user manually generated the content earlier in the workflow: Stream stories (user_message parameter for Facebook.streamPublish and FB.Connect.streamPublish, and message parameter for stream.publish), Photos (caption), Videos (description), Notes (title and content), Links (comment), and Jabber/XMPP"

cakephp / webtechnick's : share button hides like button and comments

my issue might look a strange a little bit.
i'm working on a cakephp website in which i want to integrate facebook comments, like, and share functions. i'm using for that Webtechnick's Facebook plug-in, and i think this far everything is doing great. except one thing.
whene i call comments and like:
<?php $facebook->comments(); ?>
<?php $facebook->like(); ?>
it works and i have my share and like buttons, but when i call
<?php $facebook->share(); ?>
<?php $facebook->comments(); ?>
<?php $facebook->like(); ?>
only the share button is displayed. It's like if the share button hides likes and comments
not sure if this is clear enough, I know it's a strange problem.
If anybody has experienced something similar to this please help, thank you.
You may be better off using the social plugin versions of these three. I'd recomment you start with the HTML5 versions and go from there.
See:
https://developers.facebook.com/docs/reference/plugins/like/ (does both like and send)
https://developers.facebook.com/docs/reference/plugins/comments/

Adding a Google Plus (one or share) link to an email newsletter

I am trying to find a way to embed a share/+1 link for Google+ in a Newsletter, much like the Facebook share and tweeter tweet links can be embedded in a newsletter, which can be achieved with the following two urls:
https://www.facebook.com/sharer.php?u=[URL]&t=[TEXT]
http://twitter.com/intent/tweet?source=sharethiscom&text=[TEXT]&url=[URL]
Is there a similar functionality available for Google Plus?
All I could find on my own, is the Google+ button, which unfortunately uses JavaScript and thus it cannot be used in an email newsletter. I would expect Google to provide a static url fallback, but I cannot find it anywhere.
https://plus.google.com/share?url=http%3A%2F%2Fexample.com
You can share the link on Google+ with the official Google+ share link.
Replace the url parameter with the URL encoded link you want to share.
This one works fine for me :
https://plus.google.com/share?url=your-page-url
The share link allows you to do this. It will work in an email, but it's not quite the same as the +1 button.
To use the share link, add a link element to your email that complies with the Google+ Buttons policy. Set the href attribute to https://plus.google.com/share?url={url encoded share target}
For example, linking to https://plus.google.com/share?url=http%3A%2F%2Fexample.com will allow you to share example.com on Google+: (yes, that is a working demo).
Check out the official docs for more info.
If you use this approach please be aware of the fact that it is not a direct replacement for the +1 button. The link shares the target URL on Google+, but it does not actually +1 the target page. Only the +1 button can +1 a page.
Solution for those who needs custom title, description and image. You should make following changes to target URL:
Step1. add itemscope itemtype="http://schema.org/LocalBusiness" into <html> tag. It will look like <html itemscope itemtype="http://schema.org/LocalBusiness">. More itemtypes here
Step2. Place the follwing meta tags into <head>, change content attributes according your needs:
<meta itemprop="name" content="{Custom title goes here}">
<meta itemprop="description" content="{Custom description goes here}">
<meta itemprop="image" content="{http://www.your_url.com/your_image.png}">
Step3. Add the following link to your newsletter or anywhere you want:
Share it
Tip. To check how google sees your page, you can use this tool http://www.google.com/webmasters/tools/richsnippets. Probably you'll be interested in section Extracted rich snippet data from the page
Good luck, Lauris
I'm using the following.. :)
https://m.google.com/app/plus/x/?v=compose&content=[TEXT]%20[URL]
I personally suggest Google Plus Interactive Posts button
https://developers.google.com/+/web/share/interactive
to use in your apps/websites.Here Google Plus allows many customizations to do according to the requirement. I have used it in my app. Its a better option than Share button.
Maybe this helps. It works (partially) for me.
http://www.stateofsearch.com/share-on-google-plus-any-website/
There has got to be a way to do this by hacking the +1 script.
If you are interested in just changing the apperance you should download and modify this to suit your requirements.
Then, add this to your css:
.Uu .KF {
background: url("your-replacement-image") no-repeat scroll -132px -21px transparent !important;
}
to override the Google icons. However, this is probably very unstable and subject to change.