I wonder if it is possible to render a custom post field of type number directly to a star rating when using PHP to build my loop?
I use PHP/self written short codes to render my wp query loops. Accessing custom post types with types_render_field works like a charm.
So far I created several custom post types, one is called "location-rating" and stores a number. If I would use the toolset blocks library to create my loop, I would have access to a Block called "star rating".
Is there any possibility for me to render the "location-rating" field and define it as a star rating?
Is there any documentation that you are following?
did not find anything regarding this topic so far
Is there a similar example that we can see?
-
What is the link to your site?
local development atm.
There are quite a few star ratings solutions available for WordPress, and you could try to integrate with one, but given that they typically include the UI for users to rate content rather than just display stars based on an existing field value they are likely overkill for your case.
I think you'll really need to roll your own solution, though you needn't start from scratch, you can adapt someone else's solution, we are basically talking HTML and CSS here.
Here's something I found on codepen after a quick search, for example: hidden link
thank you very much for your support. As you mentioned, most of the WP Plugins are just overkill :), so I will then go on implementing my own solution.
Thank you for the codepen. Seems like a good start.