2013-03-05 59 views
1

我願意使用wordpress的blogroll功能在我的網站上顯示合作伙伴列表。我想知道如何在wordpress的鏈接頁面中使用字段Description來接受像<a>,<p>等html標籤?我可以顯示description,但它不解釋標籤。例如,如果我在說明中加入使用html解釋在說明中顯示wordpress blogroll

This is the description of our partner. His <a href="www.bla.com">Website</a> is cool 

然後我將在網站上獲得與純文本相同的文本,但不包含鏈接!

我該怎麼做?

+0

你在說什麼 「鏈接」 經理?當你添加新的鏈接描述字段接受標籤,我剛剛檢查了數據庫,它有 – 2013-03-05 16:10:15

+0

中的標籤如果你深入研究書籤功能,你會發現'link_description'通過'esc_attr()'運行,這是因爲描述字段的初始意圖是將其用作鏈接的標題屬性。 – Jrod 2013-03-05 16:21:33

+0

嗨@Jrod。我嘗試從'desc = esc_attr'(sanitize_bookmark_field('link_description',$ bookmark-> link_description,$ bookmark-> link_id,'display'));'但是它沒有任何作用'行中刪除'esc_attr'函數調用。 – otmezger 2013-03-05 19:34:32

回答

0

Relevant core ticket關於未來將鏈接從核心中移除並轉換爲插件。


爲了能夠在Description領域(以及Notes場),使用下面的代碼的HTML標籤:

// Disable the removal of HTML tags 
remove_filter('pre_link_description', 'wp_filter_kses'); 
remove_filter('pre_link_notes', 'wp_filter_kses'); 

// Enable HTML tags the same way as in posts content 
add_filter('pre_link_description', 'wp_filter_post_kses'); 
add_filter('pre_link_notes', 'wp_filter_post_kses'); 
+0

Tahnks爲您的答覆。我把這段代碼放在我的page.php中,就在'wp_list_bookmarks($ args);'之前,它沒有任何效果:-( – otmezger 2013-03-06 13:51:49

+0

你必須將它添加到你的主題'functions.php'中,或者一個[功能插件](http://www.doitwithwp.com/create-functions-plugin/)。 – brasofilo 2013-03-06 13:55:13