In this case, the template named single-listing.php enables comment authors to add a review and star rating from 1 to 5 simply by clicking the stars. This template loads on the single listings for AgentPress Pro users however can easily be used in any other theme with any other post type or standard single posts.
Reviews are then displayed before the single entry content with a average rating added before the reviews loop like this :
To add the rating/review system to single posts or other custom post types, change the file named using the WordPress Template Hierarchy. For single posts in any category, use single.php. For single posts in a specific category named reviews, name the file single-reviews.php.
Shows stars added to reviews on single post types.
Tested using the Genesis Sample child theme by StudioPress with the AgentPress Listings plugin however will work in any Genesis child theme.
Also tested using AgentPress Pro.
There’s 4 steps :
- # Install the WP Post Rating plugin by Shoaib Saleem.
- # Upload the file named single-listing.php to your child theme folder like this :
- # Copy & paste the PHP code ( without the opening PHP tag ) from the functions.php file to the end of your child themes functions file.
- # Copy & paste the CSS from the style.css file to the end of your child themes style sheet and clear caching.