[英]The URL added while adding featured image in wordpress
我正在使用wordpress最新版本。 就像在wordrpess中一樣,我們可以在帖子中添加特色圖像的同時添加URL,因為其中包含諸如標題,標題,替代文本,描述,URL等文本字段。我添加了一個鏈接,例如http://example.com/abc -news我可以在博客文章中顯示精選圖片,但我希望該鏈接為
<a href="URL" title="">{featured-image}</a>
這樣,如果任何人單擊特色圖像,他/她都將轉到該鏈接。
任何幫助,將不勝感激。
如果您將默認主題與最新版本的WordPress一起使用,則可以在2014主題目錄中編輯content.php 。
您需要包裝<?php twentyfourteen_post_thumbnail(); ?>
<?php twentyfourteen_post_thumbnail(); ?>
,鏈接代碼指向您的URL。
這段代碼應該位於content.php的第13行。
<?php twentyfourteen_post_thumbnail(); ?>
要鏈接到當前博客文章,您可以添加以下代碼:
<a href="' . esc_url( get_permalink() ) . '"><?php twentyfourteen_post_thumbnail(); ?></a>
如果使用的主題與默認主題不同,請打開在主題中包含“循環”的文件,搜索the_post_thumbnail
或類似名稱的函數,然后如上所述更改代碼。
確切答案因主題而異,但是98%的修復方法應與上述類似。 希望這可以幫助。
編輯:這是更多信息: http : //codex.wordpress.org/Function_Reference/the_post_thumbnail#Post_Thumbnail_Linking_to_the_Post_Permalink
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.