I've installed WP-PostRatings plugin
It is to set up but I am trying to add it to the theme. In plugin template there is such code: I have tried to add these code so <php echo " These code here" ?> but it doesn't show. If I need to insert in comment php. How can I generate code for PHP loop? Not shortcode
-
You may get an answer here; but all plugins in the wordpress.org catalogue have their own support forums; in this case: wordpress.org/support/plugin/wp-postratings some plugins' forums provide excellent support others may not.scytale– scytale2018-01-15 11:46:41 +00:00Commented Jan 15, 2018 at 11:46
2 Answers
If you, for some reason, don't want to use the shortcode ([ratings]), you can always use the_ratings() directly in your template.
Make sure you are within the loop so it'll be able to identify the correct post ID for you.
If you want to use it outside the loop, you can pass your ID manually. The function's signature is
function the_ratings($start_tag = 'div', $custom_id = 0, $display = true) {
so you could call it as
the_ratings("div", 123)
if you wanted to output the ratings for the post with the ID 123.
To print a shortcode in your own code you need to use the do_shortcode() function, eg: echo do_shortcode('[ratings id="1" results="true"]');

