WordPress.org

Support

Support » Plugins and Hacks » WP-PostRatings » [Resolved] How to change the Schema itemtype and the decimal value from the average number

[Resolved] How to change the Schema itemtype and the decimal value from the average number

  • Hi,

    Please, can someone help me out on this? It should be simple, but searched a lot but i just cant find how to do these 2 things, so here it goes:

    First, How to change the schema itemtype from “article” to “aggregaterating”?

    And…

    Currently the %RATINGS_AVERAGE% is outputting a value like this: “4,00” and instead i would like it to be like this “4.00” – i need to have a point instead of the comma.

    Is there any parameter i can use to do that rather than hacking the plugin code?

    Thanks in advance!

    https://wordpress.org/plugins/wp-postratings/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Lester Chan

    @gamerz

    1. To change schema type, you need to use the latest dev version, https://github.com/lesterchan/wp-postratings/archive/master.zip

    <?php
    add_filter('wp_postratings_schema_itemtype', 'wp_postratings_schema_itemtype');
    function wp_postratings_schema_itemtype($itemtype) {
    return 'itemscope itemtype="http://schema.org/AggregateRating"';
    }
    ?>

    2. There is no way around it without hacking the code. The code is using number_format_i18n() which takes the thousand separator from your language file.

    Thanks a lot, the issue was fully solved!

    jmuller777

    @jmuller777

    I just figured out that this function is not working on pages. It works on custom pages and posts, but not on the standard wordpress pages.

    I have the code below on my function.php:

    <?php
    add_filter('wp_postratings_schema_itemtype', 'wp_postratings_schema_itemtype');
    function wp_postratings_schema_itemtype($itemtype) {
    return 'itemscope itemtype="http://schema.org/AggregateRating"';
    }
    ?>

    But on pages the output is not appearing with the the AggregateRating markup, it is displaying like this:
    <div id="post-ratings-479" class="post-ratings">... ...stuff ... ...</div>

    Could you please help me out on how to get the right markup on pages as well?

    Thanks!

    Plugin Author Lester Chan

    @gamerz

    Redownload the https://github.com/lesterchan/wp-postratings/archive/master.zip again and replace the files. It is a big, I have fix it.

    jmuller777

    @jmuller777

    Works great now, that last version solved it perfectly!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Resolved] How to change the Schema itemtype and the decimal value from the average number’ is closed to new replies.
Skip to toolbar