I would like to add a button to my website to give the opportunity to my visitors to share content to twitter and I use the following code :
<a href=
"https://twitter.com/intent/tweet?button_hashtag=TwitterStories&text=Check%20out%20this%20app%20"
class="twitter-hashtag-button" data-url="http://test.com">Tweet #TwitterStories</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>
The problem is that the url's address is visible. I would like to add a link and display only a phrase (e.g "check this link") which will link to my website.
Is that possible?
Thanks in advance.
Related
I want to embed a tweet button on a webpage with a text an url but no original referrer. I've been trying with this:
<a class="twitter-share-button"
href="https://twitter.com/intent/tweet?text=Hello%20world" url="www.something.com">
Tweet</a>
But I each time end up with the name and url of my web page in the tweet. What's the correct syntax for what I want to do? Thanks.
The url parameter should be part of the Twitter intent (like text):
<a class="twitter-share-button"
href="https://twitter.com/intent/tweet?text=Hello%20world&url=www.something.com">
Tweet</a>
Check the documentation for web intents.
can someone please advice me on how I can display hyperlink words instead of the full pdf links on my whatsApp share text field, I have started with this:
https://wa.me/?text=Aqua-Right%203%20https://rolfesagri.co.za/wp-content/uploads/2021/01/Aqua_Right_3_Label-1.pdf, http://rolfesagri.co.za/wp-content/uploads/2021/01/Aqua_Right_3_SDS-1.pdf, http://rolfesagri.co.za/wp-content/uploads/2021/02/Aqua-Right_Range_Eng_Pamphlet.pdf
This link needs to look like this when you send it to someone:
Aqua-Right 3 Label, SDS, Pamphlet
Is this possible?
These are three different links and you need to treat a link using the <a> tag.
See the documentation for the detail but your code will look like:
Label
<a href="https://wa.me/?text=Aqua-Right%203%20http://rolfesagri.co.za/wp-content/uploads/2021/01/Aqua_Right_3_SDS-1.pdf>SDS</a>
<a href="https://wa.me/?text=Aqua-Right%203%20http://rolfesagri.co.za/wp-content/uploads/2021/02/Aqua-Right_Range_Eng_Pamphlet.pdf>Pamphlet</a>
This is completely untested on what the link itself will do but is the right syntax to display a link on a webpage
I'd like to find out how to embed a specific tweet + comments.
I know how to embed the whole timeline (with Twitter widgets):
<a class="twitter-timeline" href="https://twitter.com/stats_canada" data-widget-id="608870269030137856">Tweets by #stats_canada</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
but I just need to embed one tweet using that widget (if possible).
For example this particular one:
https://twitter.com/stats_canada/status/230694020031078400?s=17
You can embed that specific tweet using this code:
<blockquote class="twitter-tweet" lang="en"><p lang="en" dir="ltr">The average Canadian says sorry over 45,000 times a day.</p>— Stats Canada (#stats_canada) August 1, 2012</blockquote>
<script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>
However, replies are different. The current twitter API doesn't seem to allow for embedding of entire conversations. What you can do after embedding this tweet is getting the embed quote for each reply, and then unchecking the "Include parent tweet" for each embed code. You can then add each one below the original tweet.
I've followed the guide here to add multiple widgets using the same widget id and this works perfectly fine for User timeline.
Snippet ----
<a class="twitter-timeline" href="https://twitter.com/benward" data-widget-id="[id]" data-screen-name="benward">
<a class="twitter-timeline" href="https://twitter.com/endform" data-widget-id="[id]" data-screen-name="endform">
<a class="twitter-timeline" href="https://twitter.com/kang" data-widget-id="[id]" data-screen-name="kang">
<a class="twitter-timeline" href="https://twitter.com/brianellin" data-widget-id="[id]" data-screen-name="brianellin">
What I would want to do is do the same( show different widgets ) for multiple hashtags - #MH17, #MH370 on the same page. But these tags change for each article on a page.
I want to know if either of these is possible.
Can I make the same guide available for a search query to this and this without creating a widget manually from the Twitter page. Timeline changes when I change the "data-screen-name" property. Is there something like "data-hashtag-name"?
Is it possible to use Twitter API or something to automate the process of creating a widget from the browser using Auth Token - Secret?
May be this help you .
Here i am sending you some example using this I am get json and render html div
Here is a sample code and demo you can use for search in twitter
1) http://www.codexworld.com/create-custom-twitter-widget-using-php/
2)you can also look into this examle may be this will full fill your requirement .
http://dev.kim-maida.com/twitter/
3) here is demo code and code sample link.
https://github.com/kmaida/twitter-timeline-php
did you see these pages?
https://dev.twitter.com/web/embedded-timelines/search
https://twitter.com/settings/widgets/new/search
You can do this:
corgi is the sample hashtag:
<a class="twitter-timeline" href="https://twitter.com/hashtag/corgi" data-widget-id="612280670367301632">#corgi Tweets</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
Whatever I set data-url or data-text to, twitter just fetches the URL of the page the sharing button exists in and shows as the tweet-text.
example :
<a target="_blank" href="https://twitter.com/share"
data-count="none" class="twitter-share-button" data-url="http://www.gogole.com"
data-text="BLABLABLA" style="opacity:0">TWEET</a>
or
<a target="_blank" href="https://twitter.com/share"
data-count="none" class="twitter-share-button" data-url="<?php echo
urlencode('http://www.gogole.com')?>" data-text="BLABLABLA" style="opacity:0">TWEET</a>
in both cases, clicking on the link opens a new window with the twitter sharing box that includes the URL of my website and ignores the attributes I set.
Something should have gone dangly wrong. help appreciated !
please tell me if you need more info to be posted.
Thanks,
/t
You can use the query parameter "url" with the twitter share link "https://twitter.com/share"
When looking for the URL twitter button follow this priority:
Look for url in the share link query string
If not found, look for the data-url attribute of the Tweet Button anchor tag
If not found, look for the rel="canonical" link tag in the head of the document
If not found use the URL of the webpage
I have faced same issue - when using link as described in manual's example it didnt work.
this NOT works:
<a class="twitterBtn smGlobalBtn" target=_blank href="https://twitter.com/share" data-text="my_title" data-url="my_url" data-hashtags="my_hash" data-via="my_name" data-related="my_name">Tweet</a>
but this WORKS:
<a class="twitterBtn smGlobalBtn" target=_blank href="https://twitter.com/share?text=my_text&url=my_url&hashtags=my_hash&via=my_name&related=my_name">Tweet</a>
Don't know why twitter ignores data- attributes, but when params are inside the link as GET params - everything works fine.
Hope this will be helpful for someone in future)
I fixed this by moving script widgets.js before button markup and turning off async mode, like this:
<script src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
<a href="https://twitter.com/share?ref_src=twsrc%5Etfw" class="twitter-share-button" data-text="H..." />
twitter-share-button class also important.