how to localize the number of wordpress post views?
-
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('১','২','à§?','à§a','à§?','à§?','à§-','à§?','à§ˉ','à§|'); $converted = str_replace($engNumber, $bangNumber, $str); return $converted; } add_filter( 'the_views', 'make_bangla_number' );
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.' à|?à|?à|°'; }
- The topic ‘how to localize the number of wordpress post views?’ is closed to new replies.