Title: Adding code customisation
Last modified: August 21, 2016

---

# Adding code customisation

 *  Resolved [gates](https://wordpress.org/support/users/gates/)
 * (@gates)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/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](http://dev7studios.com/adding-code-customisations-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
       }
       ```
   
 * [https://wordpress.org/plugins/wp-postviews/](https://wordpress.org/plugins/wp-postviews/)

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [Lester Chan](https://wordpress.org/support/users/gamerz/)
 * (@gamerz)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/adding-code-customisation/#post-4702973)
 * The filter will not work because both backend and front end will use it. If you
   change the language, it will be “.”
 * it is not possible to have both “.” and “,” without some modifications to the
   plugin. You will probably have to duplicate the the_views function to the_views_2
   or something and in [https://github.com/lesterchan/wp-postviews/blob/master/wp-postviews.php#L772](https://github.com/lesterchan/wp-postviews/blob/master/wp-postviews.php#L772)
   change it to call the_views_2
 *  Thread Starter [gates](https://wordpress.org/support/users/gates/)
 * (@gates)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/adding-code-customisation/#post-4702976)
 * Aha… thanks for letting me know. So even if I only want to change the output 
   in the front-end it won’t work? I don’t mind the commas in the back end.
 * Edit: I see you’ve updated your post. About duplicating the function; I’m afraid
   that something like that increases the chance to break something in a future 
   update. So I’ll just use the method in my first post.
 *  Plugin Author [Lester Chan](https://wordpress.org/support/users/gamerz/)
 * (@gamerz)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/adding-code-customisation/#post-4702979)
 * Nope, that is because the function is called by both front end and back end.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Adding code customisation’ is closed to new replies.

 * ![](https://ps.w.org/wp-postviews/assets/icon.svg?rev=978002)
 * [WP-PostViews](https://wordpress.org/plugins/wp-postviews/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-postviews/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-postviews/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-postviews/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-postviews/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-postviews/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [Lester Chan](https://wordpress.org/support/users/gamerz/)
 * Last activity: [12 years, 2 months ago](https://wordpress.org/support/topic/adding-code-customisation/#post-4702979)
 * Status: resolved