Well we don't have this built-in function, but you can try next, but you will need some experience with writing SQL queries and using WP hooks.
You can create table with query for example
SELECT
user_id,
user_name,
user_address,
CONCAT('<a href="http:/yoursite.com/your_custom_page?user_id=',user_id,'">Details</a>') AS Details
FROM your_table_name
and then on your_custom_page you will insert shortcode of the tableid that you need with placeholder like this
[wpdatatable id=1 var1=1]
of course, you will create that second table from query like
SELECT * FROM second_table WHERE user_id = %VAR1%
and then you will use our hook for dynamic upsetting placeholders
function updateVAR1($tableID){ global $wdtVar1; //check is set GET parametar user_id
if(isset($_GET['user_id'])){
//get value from form fieald
$wdtVar1 = $_GET['user_id'];
} }
add_action('wpdatatables_before_get_table_metadata', 'updateVAR1');
Like this I believe you will get result like you need
SQL covers MySQL, PostgreSQL, MSSQL, so you can choose "SQL query".
You can't add "WHERE Product = %VAR1%" without defining Var1.
If you need to pull everything from table1, and then use VAR as a filtering option in the shortcode, you need to add "%VAR1%" as the predefined filtering value in "Product" column's settings/Filtering tab.
Then, when you use [wpdatatable id=1 var1='product A'] it would work. So in this case you can use simple:
SELECT * FROM table1
No need to add hooks, they are already included in the plugin.
Hello, this question is slightly off the real use of the plugin.
I need to create tables for each page for multiple pages (like 500 pages).
It would be very difficult to manually setup tables for each page using the plugin.
Is there a way to add tables in html (which I will be automating) for each page?
Please let me know.
Thank you.
Hi Santhosh,
Thank you for your purchase.
Well we don't have this built-in function, but you can try next, but you will need some experience with writing SQL queries and using WP hooks.
You can create table with query for example
and then on your_custom_page you will insert shortcode of the tableid that you need with placeholder like this
[wpdatatable id=1 var1=1]
of course, you will create that second table from query like
SELECT * FROM second_table WHERE user_id = %VAR1%
and then you will use our hook for dynamic upsetting placeholders
Like this I believe you will get result like you need
Kind Regards,
Aleksandar Vuković
[email protected]
Rate my support
wpDataTables: FAQ | Facebook | Twitter | Instagram | Front-end and back-end demo | Docs
Amelia: FAQ | Facebook | Twitter | Instagram | Amelia demo sites | Docs | Discord Community
You can try wpDataTables add-ons before purchasing on these sandbox sites:
Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables
Thank you. I will try this method and get back to you.
I read about the placeholder method article. It is precisely what I was looking for.
I will be creating multiple tables in multiple posts using the same table and SHORTCODES seems the best option.
I have a few questions -
- I don't see the MySQL option in the drop down and I can see only SQL query
- Suppose I want 'names' to be a variable, how should I go about it?
Example
SELECT * FROM `table1`
WHERE Product = %VAR1%
This is showing up as an error.
Then I need to add short code something like this
[wpdatatable id=1 var1='product A']
- Also, is there a need to add any wp hook to php?
Hello Santhosh
SQL covers MySQL, PostgreSQL, MSSQL, so you can choose "SQL query".
You can't add "WHERE Product = %VAR1%" without defining Var1.
If you need to pull everything from table1, and then use VAR as a filtering option in the shortcode, you need to add "%VAR1%" as the predefined filtering value in "Product" column's settings/Filtering tab.
Then, when you use [wpdatatable id=1 var1='product A'] it would work. So in this case you can use simple:
SELECT * FROM table1
No need to add hooks, they are already included in the plugin.
Kind Regards,
Aleksandar Vuković
[email protected]
Rate my support
wpDataTables: FAQ | Facebook | Twitter | Instagram | Front-end and back-end demo | Docs
Amelia: FAQ | Facebook | Twitter | Instagram | Amelia demo sites | Docs | Discord Community
You can try wpDataTables add-ons before purchasing on these sandbox sites:
Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables
This is great. Thank you very much.
You're welcome, Santhosh
If you have any further questions or issues, please feel free to open a new ticket, and we'll gladly help.
Kind Regards,
Aleksandar Vuković
[email protected]
Rate my support
wpDataTables: FAQ | Facebook | Twitter | Instagram | Front-end and back-end demo | Docs
Amelia: FAQ | Facebook | Twitter | Instagram | Amelia demo sites | Docs | Discord Community
You can try wpDataTables add-ons before purchasing on these sandbox sites:
Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables