我正在嘗試設置在WordPress的錨標記永久,但我得到以下結果錨標記:固定鏈接在WordPress的
http://localhost/mysite/the_permalink();
這裏是我的代碼:
$result .= '<footer><a href="the_permalink();'.$link_value.'" >'.get_the_title().'</a></footer>';
我怎樣才能解決這個問題?
我正在嘗試設置在WordPress的錨標記永久,但我得到以下結果錨標記:固定鏈接在WordPress的
http://localhost/mysite/the_permalink();
這裏是我的代碼:
$result .= '<footer><a href="the_permalink();'.$link_value.'" >'.get_the_title().'</a></footer>';
我怎樣才能解決這個問題?
使用get_permalink()代替the_permalink
$result .= '<footer><a href='.get_permalink().$link_value.' >'.get_the_title().'</a></footer>';
the_permalink
直接輸出當前交到前端的固定鏈接。
get_permalink
將其作爲變量返回,但不會將其回顯出來。
由於the_permalink()
函數直接回顯URL,您的代碼只需稍作更改。它將如下所示:
$result .= '<footer><a href="'; the_permalink();
$result .= $link_value.'" >'.get_the_title().'</a></footer>';
正在工作,非常感謝你 –
不客氣。你可以接受答案,如果它的工作 –