Winter Sale Up to 50% off Up to 50% off
Grab Yours

Custom Fields integration with wpDataTables

Custom fields in WordPress allow users to add extra metadata to posts, pages, or custom post types. While WordPress provides basic fields like title, content, and publication date by default, custom fields let you add specific data tailored to your needs.

For example, if you run a movie website, a standard post might include a title and description, but custom fields enable you to store additional details such as release year, genre, or IMDb rating. These extra fields make your content more structured and easier to organize.

With plugins like Advanced Custom Fields (ACF) or Secure Custom Fields (SCF), you can create and manage custom fields containing different types of data, including text, numbers, images, and dates. By integrating these fields with wpDataTables, you can display them in dynamic tables, apply filters, and make your data more accessible and interactive.

Starting with version 7.1, wpDataTables now supports native integration with Custom Fields.
This feature allows you to pull custom fields as table columns in tables created through our WP Post Builder integration.

Common Use Cases

  • Extending posts with additional details like author bios, reading time, or featured badges.
  • Enhancing custom post types with specific fields, such as movie details (genre, release year, IMDb rating, etc.).
  • Storing structured data for WooCommerce products, including specifications, pricing, or SKU.
  • Managing dynamic content for complex layouts or advanced functionalities.

 

By integrating custom fields with wpDataTables, you can create dynamic tables that visualize this metadata, making it easier to manage and display structured information.

How to Create Custom Fields Using ACF and implement them in a wpDataTable

Example: We’ll create a Movies custom post type, add relevant custom fields using ACF, and display this data in a wpDataTable.

Step 1: Add the ACF plugin

  1. Navigate to Plugins > Add New Plugin
  2. In Search Plugins enter ACF
  3. Click Install Now and Activate

Step 2: Add Custom Fields with ACF

  1. Navigate to Advanced Custom Fields > Field Groups

2. Create a new field group  Add New >Movie Details

Step 3: Create Posts for Movies

  1. Add fields like:
  • Field Label: Genre
  • Field Name: genre
  • Field Type: Text

 

  • Field Label: Release Year
  • Field Name: release_year
  • Field Type: Number

 

  • Field Label: Rating
  • Field Name: rating
  • Field Type: Number

 

  • Field Label: Poster
  • Field Name: poster
  • Field Type: Image
  1. Set the location rules to show these fields only for the “Movies” post type
  2. Save the field group

Step 3: Add Data to Posts

  1. Go to Movies > Add New
  2. Fill in the post title, content, and custom fields (Genre, Release Year, Rating, Poster)
  3. Publish the posts

Using ACF Fields in wpDataTables with WP Post Table

Step 1: Create a WP Post Table

  1. Click on “Build a WP Post Table”
  2. Click “Next”

Step 2: Configure the Data to Display

  1. Enter table name
  2. Set Post Types to “Movie” – optional, only to include these posts we’ve made for our movies
  3. Enable additional information fields as needed

Step 3: Include Custom Fields

  1. Select the Custom Fields tab
  2. Click on “+ Add New Custom Field Column
  3. Enter “Column Header
  4. Enter “Custom Field” – the Field Name you created in ACF
  5. Click “Next
  6. Click “Create the table

Step 4: Additional Customization and Publishing

  1. Customize the table further to fit your needs
  2. Click “Save Changes
  3. Publish the shortcode of the table to your page

User Benefits

  • Enhanced flexibility to manage structured data and metadata.
  • Simplified integration of complex datasets into WordPress posts.
  • Ability to dynamically use metadata in wpDataTables for customized displays.
  • Easier troubleshooting and content updates, as data is organized and accessible via custom fields.
  • A clear understanding of post metadata structure for resolving issues quickly.
  • Enables detailed and attractive data presentations, like movie comparisons or product showcases.
  • Easy updates to tables and posts without involving developers.
  • More engaging user experiences by presenting tailored data with dynamic tables.

Additionally, starting with version 7.2, this functionality extends to WooCommerce integration, enabling the integration of custom fields with product data in your tables.

Wait, Before You Download!

To get your hands on wpDataTables Lite, please enter your email address below. We’ll send you a direct download link and keep you updated on existing features along with helpful tips and tricks!

By continuing, I accept Privacy Policy and T&C
Mail Box