簡體   English   中英

如何使博客文章標題轉到其永久鏈接

[英]How to make blog post article title go to their permalink

我目前正在使用此代碼來嘗試鏈接到博客文章的URL。

<a href="<?php get_permalink(); ?>">
 <span class="white"><?php the_title(); ?></span></p>
</a>

該代碼位於博客主頁面上,當我當前單擊帖子標題時,它將引導我進入博客主頁面

您可以改用the_permalink(),或在get_permalink()之前添加echo。

使用get_permalink()將檢索帖子的URL,但不顯示它。

get_permalink函數中傳遞$postId get_permalink($postId)

<a href="<?php get_permalink($postId); ?>">
    <span class="white"><?php the_title(); ?></span>
</a>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM