下面是用於顯示的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