如何本地化WordPress的文章浏览量? [英] how to localize the number of wordpress post views?
问题描述
我想以本地化号码显示帖子视图.我在function.php中添加了这些功能,
I want to display post view in localize number. I add these function in function.php to do so
function make_bangla_number($str)
{
$engNumber = array(1,2,3,4,5,6,7,8,9,0);
$bangNumber = array('১','২','৩','৪','৫','৬','à§','৮','৯','০');
$converted = str_replace($engNumber, $bangNumber, $str);
return $converted;
}
add_filter( 'the_views', 'make_bangla_number' );
但是我无法显示本地化的电话号码.每当我调用the_views时,它就会显示英语数字.知道如何以本地化语言显示帖子查看次数吗?
But I am unable to show the number in localize. Whenever i call the_views it shows the english number. Any idea how to show the post view number in localize language?
有关更多信息,这里是我的帖子查看功能:
For further info here is my post view function:
// function to count post views.
function setPostViews($postID) {
$count_key = 'views';
$count = get_post_meta($postID, $count_key, true);
if($count==''){
$count = 0;
delete_post_meta($postID, $count_key);
add_post_meta($postID, $count_key, '0');
}else{
$count++;
update_post_meta($postID, $count_key, $count);
}
}
// function to display number of post views.
function the_views($postID){
$count_key = 'views';
$count = get_post_meta($postID, $count_key, true);
if($count==''){
delete_post_meta($postID, $count_key);
add_post_meta($postID, $count_key, '0');
return "0 View";
}
return $count.' বার';
}
推荐答案
Parvez,
WordPress支持孟加拉语言,请参考 http://codex.wordpress.org/WordPress_in_Your_Language#Bangla _- 孟加拉语 .28bn_BD.29
There is support available for Bangla Language in WordPress, please refer http://codex.wordpress.org/WordPress_in_Your_Language#Bangla_-Bengali.28bn_BD.29
您必须要求将Bangla语言包安装到WordPress,您可以从下面的链接中找到...
You must required to install Bangla Language Pack to your WordPress, which you can found from below links...
http://svn.automattic.com/wordpress-i18n/bn_BD/trunk/messages/
http://www.shadhinbangla.com/wordpress-bangla-language-pack-beta-3/2011/10/
此外,您还必须在HTML代码中检查CHARSET必须设置为UTF-8,并且必须使用Collation CHARSET UTF-8创建MySQL数据库,以将Bangla值存储在DB中.
Also, you must check CHARSET must set to UTF-8 in your HTML code and your MySQL DB must be create with Collation CHARSET UTF-8 to store Bangla value in DB.
我还找到了一个旧的WordPress插件来显示Date&在Bangla期间,您还可以参考他们的代码来解决您的问题.这是插件链接... http://wordpress.org/extend/plugins/bangla-日期和时间数字/
Also I found one old WordPress Plugin to show Date & Time in Bangla, you can refer their code also to solve your problem. Here is plugin link... http://wordpress.org/extend/plugins/bangla-numbers-in-date-and-time/
或者您可以向WordPress支持团队寻求帮助.
Or you can ask for help to WordPress Support team.
嘿,我最近找到了在WordPress中设置Bangla语言的详细草稿,请参考此链接... http://www.lavluda.com/2008/11/08/wordpress-with-full-bangla-language-support/
Hey, I recently found detailed draft to setup Bangla Language in WordPress, please refer this link... http://www.lavluda.com/2008/11/08/wordpress-with-full-bangla-language-support/
这篇关于如何本地化WordPress的文章浏览量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!