Adding code customisation
-
I always edited the plugin to get a dot instead of a comma between thousands, because that’s how we roll in Europe: thousand is not 1,000 but 1.000. (I guess that using another language for the WP installation solves this, but I’d like to keep the backend in English). So I go to line 197 and change it this
$output = $prefix.str_replace('%VIEW_COUNT%', number_format_i18n($post_views), $views_options['template']).$postfix;
in
$output = $prefix.str_replace('%VIEW_COUNT%', number_format($post_views, 0, ',', '.'), $views_options['template']).$postfix;
But then saw this post about adding code customisation in WordPress the right way. How should I add this in my custom plugin? I’m afraid to screw something up.
add_filter( 'the_views', 'customisation_of_the_views' ); function customisation_of_the_views( /* keep this empty or copy the same code from the plugin? */) { // How to swap my customisation in line 197 }
- The topic ‘Adding code customisation’ is closed to new replies.