Writers Building Websites

Writers Building Websites

Add Star Ratings to Books on Your WordPress Website

Learn to create custom star rating fields in WordPress. Display average and total ratings for books, boosting reader trust and engagement on your author website.

Last Updated: 10 December 2024

Introduction

In this lesson, we’ll walk through creating custom rating fields to add star reviews to your book posts, a proven method to engage readers and boost credibility. By setting up both ‘Average Rating’ and ‘Total Ratings’ fields you’ll make it easy for visitors to quickly assess reader feedback and decide on making this book their next read. This practical, step-by-step guide is designed for authors looking to elevate their website’s professional appeal and functionality.

Add the Average Rating Custom Field

Amazon and other online retailers have educated readers to look for star ratings when they are browsing books. Star ratings are a fast and easy way for potential customers to decide if this book is worth their time and money.

This Average Rating custom field is how we will set the star rating for our books.

  • From the WordPress admin side bar go to ACF > Field Groups
  • Edit the BOOKS FIELD GROUP
  • Open the FIELDS tab
  • Edit the first default field titled (no label)

General Settings

  • FIELD TYPE is NUMBER

There are over 40 field types in ACF. We are only going to use a few of the fields types in this course. Click on the link in the lesson notes if you’d like to discover more about ACF field types.

  • FIELD LABEL is Average Rating
  • This will automatically fill out the field slug in the correct format of lowercase and no spaces.
  • Set the default value of this field to 5. For an average of a 5 star rating across all retailers. This can be changed for each book.

Validation

  • We’ll make this field required (this is optional but I use it)
  • Minimum value is 1 for 1 star
  • Maximum value is 5 for 5 stars

Presentation

I’m going to give this AVERAGE RATING field a description. Again this is optional but it does help if you’re coming back to admin the site weeks or months later or if you have another person acting as an admin on your website.

  • What is the average review rating for the book from all the sources where it is sold?

This description is only shown on the editing page. Website visitors do not see these descriptions.

  • I’ll set the STEP SIZE to 0.1 to enable partial star ratings like 4.8

That’s all the configuration needed for this custom field so I’ll click SAVE CHANGES

Total Ratings Custom Field

General Settings

I’ll go back to the Books Field Group in ACF to add our next custom field, ‘Total Ratings’.

  • To add the new custom field I’ll click on the ‘Add Field,’ button in the bottom right of the FIELDS meta box.
  • The field type is a number again.
  • The Field Label is ‘Total Ratings’ and I’ll keep the automatically suggested field name.

Validation

  • I’ll make this field required. Again, you don’t have to.

Presentation

I’ll add an instruction as an aid to completing the field.

  • Total number of ratings across all sales channels.
  • Save changes

I don’t have any further settings for this custom field.

Update the Book Post

Let’s update these new fields in the Adventure Danger bookpost with extra information.

  • I’ll set the average rating to 4.8
  • And the total ratings to 9826
  • Save draft

Summary

This lesson covered creating and configuring the ‘Average Rating’ and ‘Total Ratings’ custom fields for your book posts using ACF. By integrating these fields, you can display star ratings directly on your author website, providing readers with valuable insights into your books’ reviews and popularity. These enhancements improve user engagement, help potential readers make informed decisions, and elevate the professional appeal of your website.

Stephen Gordon
Stephen is the founder of Writers Building Websites and brings over a decade of experience as a freelance marketer specialising in publishing. He is also an author.

Index

Copyright © 2024 Writers Building Websites | All Rights Reserved.