WP-PostRatings

Posted in: Newspaper
Post count: 91

Hello! I’d like to add Rich Schema star ratings to every post with the plugin WP-PostRatings . Have a look, please:

https://ps.w.org/wp-postratings/assets/screenshot-5.png?rev=1206761
https://www.vizlly.com/wp-content/uploads/2018/11/blog1069b.jpg

Which file in your theme should I use to do this? single.php? Or what?

Thank you in advance…

Post count: 91

Answer me, please..

Post count: 22421

Hi,

Rich snippets can be achieved even without a ratings plugin. We have not tested any such plugin so we cannot provide any insight into it’ functionality. Please use seo by yoast: https://yoast.com/rich-snippets-everywhere/

Thank you!

Post count: 91

Hi, thank you for your answer. And for the yoast seo… I will consider using it instead.

Sorry, but whenever you see a word “plugin” you don’t bother to read and understand the question. Not good at all)))…

I did not ask for insights into WP-PostRatings plugin functionality. The question is about your theme. Where should I add the code (which files in your theme) so that the star ratings will appear under each post.

Which files?

Thank you in advance…

Post count: 20688

Hi,

Sorry for the misunderstanding. The post template files are located in the main theme folder
http://prntscr.com/md8ml6
These can be modified in a child theme so you won’t lose the changes after a theme update. A similar topic here – https://forum.tagdiv.com/topic/plugin-wp-postratings/

Thanks

Post count: 91

Thank you, I think that single.php is not a working file.

First, because it looks like single.php has a syntax error in last lines 79-81:


<?php

get_footer();

There is no closing “?>”.

The second reason I think so is that when add I the code
<?php if(function_exists('the_ratings')) { the_ratings(); } ?>
to this file – no changes on blog posts.

I need to understand what files are responsible for single posts, the logic of your theme. So, please, tell me exactly what files I should paste this code so that I will see the resulting rating stars on all blog posts?

Thank you in advance!..

  • This reply was modified 7 years by wilhard.
Post count: 20688

I tried both PHP and shortcode implementation for that plugin, the ratings appear but the design is broken in both cases, example for post template 2
http://prntscr.com/mdnkbg

I then tried on a default WordPress theme, they look alright there (by the way the single template in a default wordpress theme has the same error you mention http://prntscr.com/mdnrna this may not be an error)
http://prntscr.com/mdnry8

Seems the theme is applying some design to the post ratings, so it will need some CSS to make it look better – http://prntscr.com/mdnugv

This is the code for it

.td-post-content .post-ratings img {
display: inline;
}
.td-post-content .post-ratings img {
margin-bottom: 0;
}

Post count: 91

Thank you for your detailed reply. And especially I am very grateful for the code!!!

Post count: 19

Hi Simion,
I’m facing the same situation.

I want to implement, I tried to use whatafile plugin to discover which file I needed to modify, it shows me as it’s single_template_10.php, but I don’t see this file…

I tried to edit loop-single.php without success too, nothing shows up neither if I do a syntax error to throw on the screen, but nothing…
https://www.screencast.com/t/CCQK6xH0Aslj

Thanks
Please help

Post count: 20688

Hi,


@wspeed
Best to try by shortcode. Since theme update 9.7 the single template files have been moved in the tagDiv composer plugin – https://tagdiv.com/updating-the-core-of-tagdiv-themes/
So the post template files could be modified there directly – http://prntscr.com/ngorqf but not in a child theme anymore, because this means they will have to be remade after each update.

By shortcode you could create/import a cloud post template, place a column text in it (in the location where you want the rating to appear) and enter the plugin shortcode in it
http://prntscr.com/ngoqk3
These are the cloud post templates created by us
https://cloud.tagdiv.com/#/load/Single.
You can also modify them after you import them, or create your own from blank
http://prntscr.com/ngosqb
This should work, you could give it a try.

Thanks

Post count: 19

Hi Simion,
Thanks for your help.

I was not using any Cloud templates, so I decided to deactivate it because it clearly slows down my website (at least on the dev server). It increases many seconds while editing pages, and creating the site which is a lot of time for the developer to waste.

Anyways, I went ahead for the core modification for now (despite not adviseable because of the upgrade thing), but I could not find that file on my file structure:
https://www.screencast.com/t/ict6RDTU4rmc

I just upgraded to 9.7

Also, doing a find didn’t find the file too.

Where did this bastard go?
https://www.screencast.com/t/DEJ9PnI2tgdB

Post count: 20688

Hi,

The single templates are found in the composer plugin, in the legacy folder
http://prntscr.com/nijozi
Most of the theme files that were moved are now in that folder. So you could do your modifications there, should work.

Post count: 19

Thanks Simion.
Just found out.

Is there a way that I modify this without core modifications?

Via child theme functions.php file?

Or any other adviseable way?

Post count: 20688

Some users said it is possible to modify plugin files more safely, something like a child theme functionality. We will try to find a solution for this in the future, and create documentation for it.

So currently the solution would be to either modify the file in the plugin directly, or use the default post template which can still be copied and modified in a child theme
http://prntscr.com/njftfz

Or reconsider using a cloud template and shortcode as mentioned above.

Viewing 14 posts - 1 through 14 (of 14 total)
The forum ‘Newspaper’ is closed to new topics and replies.