1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

How to create a snippet for this?

Discussion in 'WordPress' started by Divvy, Aug 13, 2017.

  1. #1
    Hello guys,

    Can someone give me a little help?

    I have this plugin installed:
    https://github.com/lesterchan/wp-postratings

    But it shows the rating percentage like this:
    50.00% instead of 50%
    33.33% instead of 33%
    etc...

    My idea is to remove decimals. I know how to fix this changing in the file:
    https://github.com/lesterchan/wp-postratings/blob/master/wp-postratings.php

    From:
    $value = str_replace("%RATINGS_PERCENTAGE%", number_format_i18n($post_ratings_percentage, 2), $value);
    Code (markup):
    To:
    $value = str_replace("%RATINGS_PERCENTAGE%", number_format_i18n($post_ratings_percentage), $value);
    Code (markup):
    But I don't want to change directly in the plugin file because I don't want to loose changes when I upgrade the plugin. So I want to use a plugin to add a snippet to fix this. Something like this plugin.

    But I don't have enough knowledge how to do that.

    Can someone help me?

    Thanks in advance :)
     
    Divvy, Aug 13, 2017 IP