Tag Archives: plug-in

lb_langlink: 在WordPress文章標題後加入其他語言版本的連結

Screenshot這是第一個公開版本,這個WordPress Plugin能讓你在文章標題後面加入到其他特定文章連結,這些連接是該篇文章的其他語言版本。你只需要加入一個Custom Field,詳細的安裝及使用請閱讀這個wiki頁面,你也可以在頁面下載檔案。
如果你使用一段PHP來顯示你最近幾篇的文章,你可能也想要這個plugin能在這段PHP作用。以下是我用在sidebar的PHP

< ?php
$how_many=5; //How many posts do you want to show
require_once("wp-config.php"); // Change this for your path to wp-config.php file
$news = $wpdb->get_results("SELECT `ID`,`post_title`, `post_date` FROM $wpdb->posts WHERE `post_status`= \"publish\" AND `post_date_gmt` < = UTC_TIMESTAMP() ORDER BY 'post_date' DESC LIMIT ".$how_many);
if(sizeof($news)>0){
	echo "<ul>";
	foreach($news as $np){
		echo '<li>';
		echo apply_filters('the_title', '<a href="' . get_permalink($np->ID) . '">' . $np->post_title . '</a>', $np);
		echo '</li>';
		}
	echo "</ul>";
	}
?>

另外如果你使用WordPress Related Entries 2.0 Plugin,可能會出現些問題。你可以修改

$title = stripslashes(apply_filters('the_title', $result->post_title));

成為

$title = stripslashes(apply_filters('the_title', $result->post_title, $result));

related-posts.php,就應該沒有問題了。

lb_langlink: Adding language links after post title in WordPress

ScreenshotThis is first public release. This WordPress Plugin can add links after posts’ title. The links are other languages of current post. If you write a post in different languages, this plugin can add links for you. The only thing you have to setup is adding a Custom Field. For detail installation and usage, please read this wiki page. And you can also download it from that wiki page.
If you have a PHP code for showing recent posts of your blog, you may want this plugin also works for that PHP code. Here is a sample code I used in my sidebar.

< ?php
$how_many=5; //How many posts do you want to show
require_once("wp-config.php"); // Change this for your path to wp-config.php file
$news = $wpdb->get_results("SELECT `ID`,`post_title`, `post_date` FROM $wpdb->posts WHERE `post_status`= \"publish\" AND `post_date_gmt` < = UTC_TIMESTAMP() ORDER BY 'post_date' DESC LIMIT ".$how_many);
if(sizeof($news)>0){
	echo "<ul>";
	foreach($news as $np){
		echo '<li>';
		echo apply_filters('the_title', '<a href="' . get_permalink($np->ID) . '">' . $np->post_title . '</a>', $np);
		echo '</li>';
		}
	echo "</ul>";
	}
?>

If you use WordPress Related Entries 2.0 Plugin, there might be some problems. You can replace

$title = stripslashes(apply_filters('the_title', $result->post_title));

with

$title = stripslashes(apply_filters('the_title', $result->post_title, $result));

in related-posts.php. This should work.

Design a site like this with WordPress.com
Get started