-
-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to translate the output of counter ? #14
Comments
I fiddled around the code and settings near about 3 hours, and finally found the solution to this question. This needs the plugin to be edited. I am sharing my modifications to help anyone wanting to the same thing. Modify includes/shortcode.php file in this way : <?php
add_action( 'init', 'wppv_add_custom_shortcode' );
function wppv_add_custom_shortcode() {
/**
* @param $post which is Post id ( Optional )
* @author of shortcode Ronak Vanpariya.
* @desc Get Post Count For the Blog.
*/
function wppv_current_post_view_callback($atts = array() , $content = ''){
$meta_key = 'entry_views';
$view_post_meta = get_post_meta(get_the_ID(), $meta_key, true);
$view_post_meta = str_replace('1', '१', $view_post_meta);
$view_post_meta = str_replace('2', '२', $view_post_meta);
$view_post_meta = str_replace('3', '३', $view_post_meta);
$view_post_meta = str_replace('4', '४', $view_post_meta);
$view_post_meta = str_replace('5', '५', $view_post_meta);
$view_post_meta = str_replace('6', '६', $view_post_meta);
$view_post_meta = str_replace('7', '७', $view_post_meta);
$view_post_meta = str_replace('8', '८', $view_post_meta);
$view_post_meta = str_replace('9', '९', $view_post_meta);
$view_post_meta = str_replace('0', '०', $view_post_meta);
return $view_post_meta;
}
if(!shortcode_exists( 'WPPV-TOTAL-VIEWS' )){
add_shortcode( 'WPPV-TOTAL-VIEWS', 'wppv_current_post_view_callback' );
}
} Expand You can replace the Devanagari Numerals to any script ones. |
Thanks for this awesome and simple plugin. I want to translate/str_replace of the output of the counter. How can I do that ? For example, I want to replace “198” with “१९८”. (Latin to Devanagari)
The text was updated successfully, but these errors were encountered: