通过文本交换共享页面推特徽标



我想添加一个从我的wordpress网站到tweeter的共享链接。我找到了方法,但是,我想删除Twitter徽标并添加一个简单的文本链接。所以我删除了推特类"推特分享按钮",但我无法将信息检索到推特文本框中......

这是我的代码:

<a href="https://twitter.com/share" data-url="<?php the_permalink(); ?>" data-text="<?php the_title(); ?>" data-hashtags="hashtag" >THIS_TEXT_THAT_I_WANT_TO_DISPLAY and add all data content to the twitter text area</a>
<script>
!function(d,s,id){
var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){
js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";
fjs.parentNode.insertBefore(js,fjs);}}
(document,"script","twitter-wjs");
</script>

谢谢

您可以建立自己的Twitter共享URL。你不需要包含任何javascript或Twitter SDK,它只是一个HTML链接。有关构建自己的更多信息 在 https://dev.twitter.com/docs/tweet-button,只需一直滚动到页面底部。为您的标记尝试这样的事情:

<a href="https://twitter.com/share?url=<?php the_permalink(); ?>&lang=en&text='<?php the_title(); ?>' via @yourtwitterhandle&conturl=<?php the_permalink(); ?>&count=vertical" target="_blank">Tweet this</a>

有很多东西可以传递到 url 中,所以你可以调整它以获得你想要的结果。

以下是结果代码:

<a href="https://twitter.com/share?url=<?php the_permalink(); ?>&lang=en&text='<?php the_title(); ?>'+via+@twitteraccount+:+Check+this+out+<?php the_permalink(); ?>&target="_blank">Tweet this</a> 

最新更新