• Resolved ctrlaltdelete

    (@ctrlaltdelete)


    Hi, i have a problem. I am trying to add some div and span to the variables on the “Post Ratings Templates” but when i click save it empties all my classes leaving only

    <div>
    <span>

    I need it to stop deleting my code and use literally what i insert, any way achieve it?

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

    (@gamerz)

    I can’t reproduce this problem. Most probably one of your plugins is causing this conflict. Might be related to some security plugins?

    • This reply was modified 8 years, 1 month ago by Lester Chan.
    Thread Starter ctrlaltdelete

    (@ctrlaltdelete)

    Hi, try inserting exaclty this:

    <div itemprop="aggregateRating" itemscope itemtype="https://schema.org/AggregateRating">
    %RATINGS_IMAGES_VOTE% <span style="font-weight:bold" itemprop="ratingValue">%RATINGS_AVERAGE%</span> out of <span itemprop="bestRating">5</span> (<span itemprop="ratingCount">%RATINGS_USERS%</span> votes)</div>%RATINGS_TEXT%

    If you are wondering why i am using my own schema it’s because yours doesn’t limitate to set AggregateRating, ratingValue and bestRating (the only 3 really needed). It adds other tags that on my site come empty (“”) and that cause validation error plus i don’t want those tags since i’m making my own Custom post types template with my own schema it conflicts with them. I wish the plugin only added rating tags so i wouldn’t have to do this.

    Plugin Author Lester Chan

    (@gamerz)

    Ah I see, you can’t insert that for security reasons. All the templates go through WordPress wp_kses_post() for sanitization https://codex.www.ads-software.com/Function_Reference/wp_kses_post because of security reasons. The only way to archive that is to modify the code.

    If what you want can be achieve by adding a filter to the plugin https://github.com/lesterchan/wp-postratings, feel free to send a PR, I will gladly add it to the core

    Thread Starter ctrlaltdelete

    (@ctrlaltdelete)

    I think instead of adding more things to the core what should be done is remove the extra schema that are unrelated to ratings. They shouldn’t be there since they can’t possibly apply to every site.

    Aggregate ratings do not need: headline, description, datePublished, dateModified, url, author, mainEntityOfPage, image, publisher, name, logo, etc.

    Aggreagate ratings only need: ratingValue, ratingCount.
    bestRating only if different than 5. if not 5 is assumed.
    worstRating only if different than 1, else 1 is assumed.

    https://schema.org/AggregateRating

    By adding only schema related to ratings you make sure it doesn’t cause validation errors due to extra unneeded markup.

    Plugin Author Lester Chan

    (@gamerz)

    Unfortunately, it is needed. It was not there before and a lot of people complain about missing stuff (You can just look through this forum, there are a lot of feedback on it last time). Personally, I encountered the same thing as well.

    Some themes I know do add in these so that it is not needed by this plugin.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Adding custom classes on Post Ratings Templates’ is closed to new replies.