[plugin]看了這篇文章的人也看了哪些文章?
Plugins, Wordpress 6月 11日, 200806.11,2008- Plugin名稱:Where did they go from here?
- 改良版:Where did they go from here 插件修改版
我把這個插件修改了下,讓它只記錄瀏覽過的日誌。並且把其中的自動把這個列表功能取消。現在你調用這個插件需要手動在 single.php 模板中加入 show_where_they_go() 這個函數。
- 功能:在頁面上紀錄並列出看這篇文章的人也看哪些文章
- 語系:English
- 適用wordpress版本:2.0~2.5以上
安裝
- 下載Where did they go from here?,解壓縮後放置到 /wordpress/wp-content/plugins/ 資料夾下,並到後台啟用即可(假如你使用修改版的需放置程式碼)。
自訂位置
假如你想要搬移列表出現的位置,請照以下步驟:
- 開啟wheredidtheygov1.php,找到倒數第三行,刪掉它
add_action('comment_form','show_where_they_go'); - 開啟使用中的佈景主題的single.php,加入這段程式碼
<?php if (function_exists('show_where_they_go')) show_where_they_go(); ?>範例:讓列表出現在文章內文後
<?php the_content('<p class="serif">Read the rest of this entry »</p>'); ?> <?php link_pages('<p><strong>Pages:</strong> ', '</p>', 'number'); ?> <?php if (function_exists('show_where_they_go')) show_where_they_go(); ?>
更改顯示樣式、中文化
假如你想更改顯示樣式,請開啟wheredidtheygov1.php,在最後小心地更改HTML部份,以下是去除大標題、使用粗體字、並中文化的範例:
echo "<strong>看這篇文章的人,他們也看:</strong><ul>";
if ($lpids) {
foreach ($lpids as $lpid) {
echo '<li><a href="'.get_permalink($lpid).'">'.get_the_title($lpid).'</a></li>';
}
}
else
echo '<li>(還沒有資料)</li>';
echo "</ul>";
注意!
若你將外掛內容更改為中文,必須在存檔文件時另存為「UTF8不含BOM」才不會造成亂碼或程式錯誤
若你將外掛內容更改為中文,必須在存檔文件時另存為「UTF8不含BOM」才不會造成亂碼或程式錯誤
691 Human & 795 Bots









6月 11th, 2008 at 8:02 pm
這個超實用,之前有看到都一直忘了問,沒想到現在就生出來了。超級感謝…