WP Post / Custom Post Type Integration

Ninja Tables have created a very special feature, which is WP Post. With the help of this feature, any post, including any Custom Post Type, can be incorporated into your tables using Ninja Tables. This feature basically shows the posts on your page in a table format.

Create WP Posts table #

Let’s dive into this simple guide to demonstrate how to implement this function in detail.

  • With the built-in WP Post feature of Ninja Tables, you can convert your WordPress Pages, Posts/CPT, and WooCommerce items into a table format without installing any additional add-ons like other plugins.
  • For instance, there are some pages, blog posts, or customized posts in the WordPress dashboard. Then these items will be displayed in the form of a table. To do this, go to the Ninja Tables dashboard → Add Table in the top right corner.
Add Table
  • Then a pop-up box will appear. Click on the WP Posts and add a title to your table.
WP Posts
  • All Post Types will be in the checkbox fields; you can choose as per your requirements.
  • Only check your preferred Post Type first. You can select various Post Types that suit your needs.
  • Keep in mind that choosing the Post Type correctly is important.
  • If you are dealing with a post, then select a post. The case is similar when it comes to selecting a product.
  • A single Post Type is chosen in this example –
Post Type
  • Switch your selected post types from left to the right, and move on to the next.
Selected Type
  • You’ll see that all the properties of the post you chose are displayed.
All Properties
  • Those properties are like the columns in your table. Select the properties you want to show in your table, and transfer them from left to right. Then you can set multiple conditions for the properties of your post if you wish.
Selected Properties
  • Save the settings after all the configuration is set up. Then you can view the output of this setup.
  • Now, all the post items have been added here. The post table also has paginations & you can search for any posts from this table.
  • In this section, there is one more amazing feature available. If the Post Type contains Categories or Tags, you can create columns for them with just a few clicks. At the bottom of All Properties, you will find options for them.
Query Settings

Now, go to the Query Settings tab of that post table. Scroll down, and here you will get two options, one is Conditions & another is Meta Query.

Conditions #

Table Query can be performed using Conditions based on the available fields.

  • Query Limit for Frontend: This enables you to specify how many posts/CPTs you want to show in total in the Frontend & if you want to show all, you can leave them blank.
  • Order by Column: You can select your preferred column by which the table will be sorted.
  • Order by Type: There are only two options to sort the table rows. Ascending or Descending.
  • By clicking on the + icon, you can add as many conditions as you want.

Let’s look at an example where we can add a condition to find out the column, which is the ID equal to 129.

Conditions
  • Now, see how these conditions work. It should show only the ID where the ID number is 129.
Result of Conditions

Meta Query #

You can add an additional meta query here to filter the table rows.

If you want to apply a meta query, you need the meta key, which will be compared to the value of your columns.

For instance, in this case, the meta key is the acf_demo, and the value ACF Demo Example will be In the meta key. It will then display only the row with the Meta name ACF Demo Example. See the below screenshot –

Meta Query

Don’t forget to click the Update button when the configuration is done!

This is also applicable to other custom post types!