Hi Marco,
Thank you for your query about my plugin. I will be happy to answer.
Yes, what you want can be easily achieved with the plugin hooks. Please see the plugin’s docs > developer API > wcpt_query_args
filter hook.
You can use this filter hook to modify the product query arguments used by the table. In this case you might want to use the post__in key to add your custom set of post ids.
See a code example below:
// custom query for product table
add_filter( 'wcpt_query_args', 'custom_query_args' );
function custom_query_args( $query_args ) {
$table_data = wcpt_get_table_data(); // table data
if( $table_data['id'] == '123' ){ // target table id
$post__in = array(); // add your custom post ids
$query_args['post__in'] = $post__in; // insert your custom arg
}
return $query_args;
}
Notes on the above code:
- We are hooking into the product query before the table prints the products as we wish to modify the query args.
- First we check if we are currently working on the table we want to target by looking up current table data and settings a condition against its id.
- Then we replace the post__in key of the query args with our own array of product ids and return it to the table.
I hope this information helps! Please feel free to write in if you have further questions.
Useful plugin links: Tutorials | Documentation | FAQs
Regards,
Kartik