我正试图在我的WordPress帖子中添加一个自定义的“推特此”按钮。我坚持official Twitter guidelines.
这就是我真正想做的;我不想要按钮,我想要定制的外观-对我来说,它只是文本。这是我使用的代码:
<a href="https://twitter.com/share?url=<?php echo urlencode(get_permalink($post->ID)); ?> &text=<?php the_title(); ?> &via=username&count=horizontal" class="custom-tweet-button">Tweet</a>
Output:
这是通过@username获得的帖子标题所以问题是permalink(<?php the_permalink(); ?>
)无法显示。
我试过:
https://twitter.com/share?url=<?php echo urlencode(get_permalink($post->ID)); ?>
https://twitter.com/share?url=<?php the_permalink(); ?>
如果我的代码有问题,或者这是一个问题,因为我使用local WordPress 为了发展?