So I have the following code for facebook share.
<a href="http://www.facebook.com/sharer.php?u=<?php the_permalink(); ?>" class="post_share_facebook" onclick="javascript:window.open(this.href, '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=220,width=600');return false;">
<i class="icon-facebook"></i>
</a>
Right now, when the share button is clicked, the whole snapshot of the page is shown on the share window.
On a php file where this share button is located, I have a specific div which I want to show on the Facebook share window instead of the whole snapshot of the page.
Does anyone know how I can do this?
Thanks!
Not sure if its possible that way, you can try <?php the_permalink(); ?>#your_div_id
Another alternate would be using open graph
Related
I need to insert the my page permalink on the end of a Facebook share URL.
Any help is much appreciated. E.g. <a href="facebook.com/share.php/'<?php the_permalink(); ?>'"> doesn't work.
The format of the Facebook sharing link is:
https://www.facebook.com/share.php?u={{LINK}}
So in your example it'd be:
<a href="https://www.facebook.com/share.php?u=<?php the_permalink(); ?>">
I have referred to the solution given in this answer but failed to make it work. I have an index.php page which says:
<a href="page.php#anchor-name">
However, this link always direct to page.php and not to #anchor-name div on that page.
Is this so because I'm trying on localhost? Whats the problem that this works on HTML but not php? Whats the solution to make this work on php?
The relevant section of the code:
<a class="metro-box blue-gradient normal" href="Services.php#Ecommerce">
<div class="metro-box-icon"><i class="icon-user"></i></div>
<div class="metro-box-title"><h5>Cloud Utilities</h5></div>
</a>
I want the hyperlink to land on this div on Services.php:
<div class="three-fourth last-in-row" id="#ECommerce">
You are dealing with named anchors.
In this, you can give link to a particular section in the page.
E.g.
Say, I have following divs.
<div id="first">Bla Bla</div>
And this div is far below header, you can give a link to it using hash.
Go to First
By clicking on the link, your respective div will get focused.
I have 5 divs in my program and in each div, it contains different content and share on FB button. Now when I click on this button, I need to share that particular content on FB. How can I do that?
There are 2 ways. Below links may help you. I am using code from this article.
1) Using javascript:
http://thinkdiff.net/facebook/new-javascript-sdk-oauth-2-0-based-fbconnect-tutorial/
2) Graph API
http://thinkdiff.net/facebook/php-sdk-3-0-graph-api-base-facebook-connect-tutorial/
Try this
<?php
$title=urlencode('Dressfinity');
$url=urlencode('http://www.facebook.com/pages/Dressfinity-LLC/208406062583392 ');
$image=urlencode('http://livemarketnews.com/dressfinity/skin/frontend/default/default/images/logo.jpg');
?>
<a onClick="window.open('http://www.facebook.com/sharer.php?s=100&p[title]=<?php echo $title;?>&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>
For each div.
FB php SDK: https://developers.facebook.com/docs/reference/php/
This is full FB documentation for their PHP API.
I'm currently using Wordpress and I have website listings that has link names as titles (eg. www.test.com, www.test2.com)
With this php code, it calls out the name of the website link:
<h3 class="list"><a class="h1" href="<?php the_permalink(); ?>"><?php the_title(); ?></h3>
Now that website has a "readmore" button and a "visit website" button. I'd like to turn the "visit website" button into a external link using PHP.
For example, the website listing is called "www.test.com". I'd like to turn the "visit website button" into an external link that will make it go to "www.test.com".
Here is my html code for the "visit website button":
<div id="visit">
Visit website
</div>
I hope someone can help.
Thanks!
I suppose you could do something like this instead
<h3 class="list"><a class="h1" href="http://<?php the_title(); ?>">Visit Website</h3>
If the_title is a valid URL starting with www (not http://), then it'll work. If they already have http:// in the title, remove that part.
Whenever you click a link you are visiting the url specified in href attribute.
For example to create a link, to go to google.com I would do this
Go to Google
So in you case you replace # with your link
<div id="visit">
Visit website
</div>
code it in php:All i can think of is this code:
<?php echo "<a href='http://www.test.com'>visit site</a>" ?>
I guess you are confused by
<?php the_permalink(); ?>
the_permalink(); calls get_permalink(); which finally provides the link.You can see its source code in wp-includes/link-template.php.
At the top of this page there's a <p> element that contains a button for Twitter, Facebook, and Stumbleupon. The code that produces these buttons is:
<p align="right"><kamran></p>
When I run the same app on a local Apache server, these buttons are not produced, I just get
<p align="right"><kamran></p>
Can someone explain what this <kamran> tag is and why it doesn't get converted to a series of buttons when I run the app locally?
The page in question is generated using Pixelpost, a photo-blogging platform written in PHP.
Kamran is a pixelpost add-on. The code in the page activates the kamran.php file, which inserts the "share" links.
This is what I see in the relevant paragraph when I click 'View Source' in my browser:
<p align="right"><a target='_blank' href='http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.blork.org%2Fstreetscene%2Findex.php%3Fshowimage%3D12&t=Street+Scene+by+Blork-Street+Scenes+from+Montreal+and+Beyond%3A+Hommage+%C3%A0+F%C3%A9lix+%282%29'><img src='http://www.kamran.ir/icon/icon-facebook.png' alt='facebook icon' title='Facebook'/></a> <a target='_blank' href='http://twitter.com/home?status=Street+Scene+by+Blork-Street+Scenes+from+Montreal+and+Beyond%3A+Hommage+%C3%A0+F%C3%A9lix+%282%29 http%3A%2F%2Fwww.blork.org%2Fstreetscene%2Findex.php%3Fshowimage%3D12'><img src='http://www.kamran.ir/icon/icon-twitter.png' alt='twitter icon' title='Twitter' /></a> <a target='_blank' href='http://www.stumbleupon.com/refer.php?url=http%3A%2F%2Fwww.blork.org%2Fstreetscene%2Findex.php%3Fshowimage%3D12'><img src='http://www.kamran.ir/icon/icon-stumbleUpon.png' alt='stumbleUpon icon' title='stumbleUpon' /></a> </p>
You can see the URLs of the button icons in there. (They are from an Iranian site, www.kamran.ir.) I am not an html expert; I thought at first that kamran must be a macro defined in templates/egocentric/styles/egocentric.css, but it's not. Is it possible that the site has changed since you last looked at it?