wp-postviews-plus small tool support qtranslate

I use wordpress wp-postviews-plus to make access to the statistics of the number ofTaiwanese friends to write, is still very good for users or robots, respectively, statisticsand another to use the ajax way, even with the cachewill not affect its display. wordpressbackground detail settings not described in detail.

Major update to say the comment system, so in the right side of the page hits statisticsarticle, I consider the wp-postviews-plus comes with the gadget into the sidebar insideon display placed in the toolbar the default sort set in accordance with the total number of visits, and other default, click Save. Enter the home to one view, the findings suggest thatthe title of the article or the article title format qtranslate (Site written by German Chineseqtranslate English page), such as <! -: zh -> <-: -> <! -: En -> <! -: ->, Because qtranslatethe way stored in this way, for different languages ​​to match the corresponding label in thetext display, the wp-postviews-plus, the gadget did not take into account the existence of such conditions, it is directly to the title displayed, become very complicated and uglyinterface, learned that the problem began to modify.

The main problem is that wp-postviews-plus plug-in code, it should only be in the showtitle widget.php code qtranslate function to extract the current language corresponding tothe contents of can. To find the next relevant information The main conversion functionqtranslate for qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage do not know what php, but the basic should have almost all the way through widget.php found in thepostviews_plus.php of the my_str_replace function is to generate the correspondingstring function $ post-> post_title under useqtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage handle, you can display only the contents of the current language, but not all. The detailed revised code is asfollows, $post_title row code is the modified code:


function my_str_replace($template, $post, $chars) {
	$post_views = intval($post->views);
	$post_title = isset($post->post_title) ? wp_specialchars(qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage($post->post_title)) : '';
	if( $chars > 0 ) {
		$post_title = pp_snippet_text($post_title, $chars);
	$post_excerpt = views_post_excerpt($post->post_excerpt, $post->post_content, $post->post_password, $chars);
	$temp = stripslashes($template);
	$temp = str_replace("%VIEW_COUNT%", number_format_i18n($post_views), $temp);
	$temp = str_replace("%POST_TITLE%", $post_title, $temp);
	$temp = str_replace("%POST_EXCERPT%", $post_excerpt, $temp);
	$temp = str_replace("%POST_CONTENT%", $post->post_content, $temp);
	$temp = str_replace("%POST_DATE%", mysql2date(get_option('date_format'), $post->post_date), $temp);
	$temp = str_replace("%POST_URL%", get_permalink($post->ID), $temp);
	return $temp;

本文固定链接: http://www.higis.org/en/2012/05/16/wp-postviews-plus-support-qtranslate/ | Hi,GIS

该日志由 H.J 于2012年05月16日发表在 Program 分类下, 你可以发表评论,并在保留原文地址及作者的情况下引用到你的网站或博客。
原创文章转载请注明: wp-postviews-plus small tool support qtranslate | Hi,GIS
关键字: , , , ,

wp-postviews-plus small tool support qtranslate:目前有1 条留言

  1. 沙发


    2012-09-14 %I:%M %p [回复]