If your having problems with qTranslate and the next_posts_link / previous_posts_link & next_post_link / previous_post_link template tags then I recommend dropping the following two functions into your theme’s functions.php file.
/***************************************************************
* Function qtranslate_next_previous_fix
* Ensure that the URL for next_posts_link & previous_posts_link work with qTranslate
***************************************************************/
add_filter('get_pagenum_link', 'qtranslate_next_previous_fix');
function qtranslate_next_previous_fix($url) {
return qtrans_convertURL($url);
}
/***************************************************************
* Function qtranslate_single_next_previous_fix
* Ensure that the URL for next_post_link & previous_post_link work with qTranslate
***************************************************************/
add_filter('next_post_link', 'qtranslate_single_next_previous_fix');
add_filter('previous_post_link', 'qtranslate_single_next_previous_fix');
function qtranslate_single_next_previous_fix($url) {
$just_url = preg_match("/href=\"([^\"]*)\"/", $url, $matches);
return str_replace($matches[1], qtrans_convertURL($matches[1]), $url);
}
From:http://www.qianqin.de/qtranslate/forum/viewtopic.php?f=3&t=2019
Comments
1,167 responses to “修复 next_posts_link & previous_posts_link 与 qTranslate 的兼容问题”