Display Firestore Collection Data

This shortcode will help to retrieve a whole collection data from Realtime database and display it as a table on your page or post.

Remember to set the security rule for your database, so the right people can read your document.

// show realtime data basing on collection name & document id
// You can limit the number of data by adding a limit parameter

// Generate a link to a child page by adding "child_page" & "child_page_target_field"

[firestore_col class='your-class-name' collection_name='users' display_fields='email,firstName,dateOfBirth,gender,food,hobbies,phone' limit=30 child_page='https://wordpress.dalenguyen.me/dynamic-display-firestore-data-from-table' child_page_target_field='email']

I suggest that you also add this shortcode to show any error when retriving data:

[firebase_error class='your-class-name'][/firebase_error]

It will get data from users collection, and the fields that will be shown are email, firstName, gender, food, hobbies, phone. You style it by replacing your-class-name.

Here is how it will be displayed: