下面是用于显示的WhatsApp共享图标的代码,条件中使用wp_is_mobile
:如何在URL中包含wordpress标题而在条件标签中使用echo?
<?php
if (wp_is_mobile()) {
echo '<a href="whatsapp://send?text=' . the_title() . ', from ' . get_bloginfo('name') . ' ' . wp_get_shortlink() . '" data-action="share/whatsapp/share">';
echo '<i class="fa fa-whatsapp"></i></a>';
}
?>
的the_title
是显示WhatsApp的图标前屏幕上的标题后,在代替的URL。 如何让我的文章的标题是URL的一部分,并在文本不显示在屏幕上
你试过'get_the_title()'吗? –
是的,正如@dingo_d建议下面 – theKing