Writers Building Websites

Writers Building Websites

Add Dynamic Retailer Buttons to Your Book Posts

Learn to add dynamic buttons for additional retailers to book posts. Enhance reader choice and site flexibility by showing links only when fields are populated.

Last Updated: 10 December 2024

Introduction

Providing links to multiple retailers on your book pages ensures visitors can purchase your books from their preferred platform. In this lesson, you’ll learn how to create dynamic “Other Retailer” buttons using Advanced Custom Fields (ACF). These buttons only appear when populated, giving you flexibility to manage links for each book while maintaining a clean, professional design on your author website.

What are Other Retailer Buttons?

Lets take a look at the core Dirk Volcano site.

When I look at the Adventure Danger Books post on the Core Dirk volcano site you can see that underneath the primary call to action there are FOUR entries in the other retailers area.

But 

When I look at the Murder at the Parsonage book post, it has no entries for other retailers so doesn’t display any buttons on the front end.

All fully dynamic based on the entries in the book’s post.

Using a combination of custom fields and the conditions feature on Breakdance elements we can have multiple Other Retailer Buttons on a book post that will only show if the field has been populated.

Other Retailers Select Field

We start with making a choice.

Other Retailers – Yes or No?

From the WordPress admin sidebar go to ACF then Field Groups.

General Settings

  • Edit the Books Field Group
  • Add a new field
  • Scroll down the list and choose the Select Field type
  • The field label is Other Retailers
  • Accept the default field name
  • The select choices are
    • Yes 
    • No
  • Make this field required
  • Under presentation add the following instructions
    • Do you offer this book from more than just your Primary retailer?
  • Save Changes

Other Retailer 1 Group

Next we are going to add the first of the Other Retailer Group of fields to capture the retailer name and link.

  • Add a new field
  • The field type is Group
  • The field label is Other Retailer 1
  • Accept the default field name

We’re going to make use of the Select felid we created earlier as conditional reference to only show this group field when Other Retailers is set to Yes.

  • Under Conditional Logic set this field to show when
    • Other Retailers
    • Value is Equal to
    • Yes

Other Retailer Button Text

We’ve set up the Group field now to add the subfields to get the Other Retailers Name and URL.

  • Add a new sub field to the Other Retailer 1 group field
  • The field type is Text
  • The field label is Other Retailer Button Text
  • Accept the default field name

Other Retailer Button URL

  • Add a new sub field
  • The field type is URL
  • The field label is Other Retailer Button URL
  • Accept the default field name
  • Save Changes

The Other Retailer Groups

We’re going to give this core build a maximum of 4 other retailer buttons but luckily we don’t have to create the other 3 from scratch.

  • Hover over the Other Retailer 1 Group field
  • Click on the Duplicate option

ACF will copy, paste and rename the Other Retailer Group field into the Other Retailer 2 Group field inlcidng the subfields.

  • Repeat two more times for a total of four Other Retailer Groups.
  • Save changes

Update the Book Post

Now we’ll edit the Adventure Danger book post and add the other places visitors can get the title.

  • There’s a new addition to the Books Field Group Meta box
  • Under Other Retailer select Yes.
  • This will open up the Other Retailer Button Groups
  • I’ll add four of the main online book sellers.
  • Save the draft post.

Now, we don’t have to add all four Other Retailer. You’ll see when we set up the Book Post Template the buttons will only show if the fields are populated.

Summary

This lesson demonstrated how to create dynamic “Other Retailer” buttons for your book posts using ACF. By adding custom fields and utilising conditional logic, you can manage retailer links that display only when populated. This feature enhances reader choice, streamlines site management, and ensures your book pages look professional and user-friendly, regardless of the number of retailer options available.

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.