Plugin Demo: Products in a Table

This demo shows how to add ratings to the post/page without having the ratings connected to actual WordPress entities. The example is for showing products inside the table on the page.

The catch here is that these products are not part of WordPress – they are not posts or any other data, they might be random products just linked for affiliate purposes. In this demo, the product’s ratings are assigned to the new rating type, belonging to Custom entity, where we created Type called ‘Products’.

To see the live demo, visit the GD Rating System Pro demo page here:
www.gdratingsystem.review/products-in-a-table

Create new rating type

For this purpose, we create ‘Products’ rating type inside the Custom rating Entity. Open the ‘Rating Types’ panel, and click Edit for the ‘Custom’ Entity. Add, new rating type, it will look like this:

New custom rating type
New custom rating type

Now, we have the Entity/Type, but we also need a unique ID’s to identify these products. Since they are not in our system, they don’t have ID’s. If you have some your internal ID’s that you will always use for same products, that is great, use them (as long as they are positive integer numbers). If not, think of the way to make them unique. Here is the suggestion: these ID’s can be created based on the ID of the page where the table is added, with added 2 zeroes and numbers 1 to 5 (5 rows/products). And, if the first product is used somewhere else, make sure to use this exact ID in all places so that ratings will be preserved. Also, you can simply assign sequential ID’s from 1 up, again make sure to use same ID’s for same products.

Create a table in the page

Create HTML table (or some other table), and for each product add the shortcode like this:

[gdrts_stars_rating type="custom.product" id="228001"]

Type is set to Custom entity, Product type. And, ID is our pseudo unique for each product. If you have 5 products, ID’s will be 228001, 228002, 228003, 228004, 228005. Or, simply use 1, 2, 3, 4, 5.

To see it in action, check out the Live demo page.

To see the live demo, visit the GD Rating System Pro demo page here:
www.gdratingsystem.review/products-in-a-table
0
0
54
Rate this article

You are not allowed to rate this post.

2 Comments

  1. werner says:

    Thank you for this explanation!

    Question: “integer” numbers?

    Doesn´t (positiv) integer mean up to 32.767 ?
    Or do you mean LONGINTEGER up to 2.147.483.647 ?

    1. MillaN says:

      Integer ID for this is defined as UNSIGNED BIGINT in MySQL, and it can be from 1 to 18.446.744.073.709.551.615.

Leave a Reply