#26774 closed enhancement (wontfix)
Move wp_star_rating() to be more accessible on the front end
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 3.8 |
Component: | Formatting | Keywords: | |
Focuses: | Cc: |
Description
This is a great little function that would be useful on the front end for all sorts of things. There are many star rating Plugins out there but I'd prefer to use the core WordPress function.
At the moment wp_star_rating() is in /wp-admin/includes/template.php which is a pretty big file to include on every front end page (73 KB) and contains mostly functions that would never conceivably be used on the front end.
Is there a better location for wp_star_rating() that would make it more accessible for front end for developers?
BTW - I noticed the Codex page needs updating as the source file link incorrectly points to wp-admin/includes/formatting.php, which makes the guide for using wp_star_rating() on the front end invalid.
http://codex.wordpress.org/Function_Reference/wp_star_rating
Change History (7)
#2
@
11 years ago
The Codex has been updated to the correct source file: http://codex.wordpress.org/Function_Reference/wp_star_rating#Source_File
#3
@
11 years ago
@kpdesign Thanks for the speedy correction Kim.
@markoheijnen:
It would be nice to use it on the front end if possible but I'm aware there are some considerations. It also depends on if we want to force usage of dashicons with wp_star_rating()
?
If we want to give users flexibility to use their own font icons then I'm thinking the CSS selectors should remain generic. Also, dashicons could be enqueued by default inside wp_star_rating()
as you suggested, but optionally turned off via an argument if needed.
That would make the function both easier to include and flexible at the same time.
#4
@
11 years ago
It it's only the HTML then I don't really see the point of moving this function. I would say that it's better to copy/paste the function if you really like it.
#5
@
11 years ago
- Milestone Awaiting Review deleted
- Resolution set to wontfix
- Status changed from new to closed
I am not a fan of the idea of having to maintain this function to work properly and with back-compat across the front-end rather than just the admin. The more complexity we introduce, the more impossible it will be to change it later.
#7
in reply to:
↑ 6
@
11 years ago
Replying to markoheijnen:
What about the non dashicons class naming? Should that be changed?
I wouldn't remove the existing classes, as they are descriptive, but if adding existing classes means we can remove some CSS, might be worth looking at. New ticket, though.
I can see why you would love to have this on the front end but unsure if we should do it. It's a small function that doesn't load the styling now. I do believe we should replace our custom classes like
star-full
withdashicons-star-filled
. We could even do awp_enqueue_style('dashicons');
insidewp_star_rating()
. That would make including this function a bit easier.I do have to say that this isn't a star rating plugin but just the display function.