Posted in: Dynamic Content

Posted on:

Dynamic Testimonials with ACF & Bricks Builder

Creating a dynamic testimonial system for your website can streamline content management and offer a flexible solution for displaying client feedback.

This tutorial guides you through setting up a custom testimonial structure using Advanced Custom Fields (ACF) and a page builder of your choice, such as Bricks Builder, Generate Blocks, or Elementor Pro. 

The process covers creating custom post types and meta fields, integrating dynamic data, and employing a query loop to display testimonials randomly. This system enhances the user experience by showcasing a variety of testimonials and simplifying content updates.

Step 1: Creating a Custom Post Type

Begin by creating a custom post type specifically for testimonials. For this, we’ll use the free ACF plugin:

  1. Navigate to the “Post Types” section and click “Add New”.
  2. Fill in the singular label for your testimonial post type. The post-type key will be generated automatically, but you can modify it if desired.
  3. Only add a taxonomy if organizational tags are needed.
  4. Under advanced configuration, ensure the support options for the title, editor, and featured image are selected. These will be necessary for our testimonials.
  5. Activate the post type and save your changes.

Step 2: Adding Custom Meta Fields

Now, add custom fields to enrich the testimonial post type:

  1. Create a new field group in ACF for your testimonials.
  2. Add a text field named “Author’s Name” for the testimonial author.
  3. Add another text field named “Author’s Position” to specify the author’s job title or role.
  4. Set the location rules for the field group to apply when the post type ‘is equal to’ your custom testimonial post type.

Step 3: Inputting Testimonial Data

With your custom post type and fields set up, you can now add testimonials:

  1. Navigate to the new testimonial section in your WordPress dashboard.
  2. You can add a new testimonial by entering the title, testimonial content, author’s name, position, and image of the author.
  3. Publish the testimonial.

Step 4: Integrating Dynamic Data into Your Layout

Using your preferred page builder, design a layout for displaying testimonials. Replace placeholder elements with dynamic data corresponding to your custom post type and fields:

  1. For the title and content, select the dynamic options for post title and post content, respectively.
  2. For the author’s image, use the dynamic option for the featured image, selecting the thumbnail size.
  3. For the author’s name and position, utilize the custom ACF meta fields created earlier.
  4. Set up a query loop to ensure your layout pulls the correct data. Choose your custom post type (testimonials) and set the display order to randomize. This ensures a varied display of testimonials.

Step 5: Saving and Reusing the Testimonial Template

After finalizing the layout:

  1. Save your testimonial block as a template for easy reuse across your site. This template can now be inserted into any page, maintaining all dynamic data connections and styling.
  2. When creating new pages or sections, insert the testimonial template to display varied testimonials dynamically without additional configuration.

This approach to dynamic content generation offers a scalable and efficient method for managing testimonials. By leveraging custom post types and meta fields, you create a system that’s easy to update and enhances the site’s engagement through randomized testimonial displays.

Conclusion

The tutorial demonstrates a practical example of using custom post types and meta fields to generate testimonials dynamically. This technique can be adapted for various use cases, significantly speeding up content management and making your site more dynamic and engaging. 

Explore further tutorials and resources for more advanced applications of ACF, custom post types, and dynamic content strategies.

Join The Community

Join over 13,500 WordPress enthusiasts and become part of a vibrant community.