Hi,
thanks for your question!
The source of the problem is very, very likely the Suhosin PHP extension, see http://wordpress.org/support/topic/289836
The symptoms are pretty equal.
Really nice idea to work around this with the Shortcode parameters. I’ll have to remember that! 🙂
You are right, there also is a Shortcode parameter “datatables_customcommands”. The problem with it that (as in your case), the Custom Commands usually contain quotation marks (“) and single quotation marks (‘).
However, those are used by the WordPress Shortcode API engine to actually parse the Shortcode and determine the parameters, so you can not use both of them in your Custom Command.
So, changing the ” to ‘ should do the trick.
Can you try this Shortcode?:
[table id=1 datatables_customcommands="'sPaginationType': 'full_numbers', 'iDisplayLength': 50, 'aaSorting': [[1,'desc'], [2,'desc']]" /]
That should not make any trouble hopefully 🙂
Best wishes,
Tobias
Thread Starter
mlynge
(@mlynge)
Hi. Thank you for your as usual for your quick reply 🙂
Changing the ” to ‘ did the trick for:
[table id=1 datatables_customcommands="'sPaginationType': 'full_numbers', 'iDisplayLength': 50" /]
However datatables_customcommands="'aaSorting': [[1,'desc'], [2,'desc']]"
didn’t work. I think WP misinterpret the brackets []
So my solution was to make a template with the following WP-table-reloaded template tag. The custom commands works as intended when using the Template Tag.
<?php wp_table_reloaded_print_table( "id=1&use_tablesorter=true&print_name=false&alternating_row_colors=true&row_hover=true&first_row_th=true&datatables_sort=true&datatables_paginate=true&datatables_lengthchange=true&datatables_filter=true&datatables_info=true&datatables_customcommands='sPaginationType': 'full_numbers', 'iDisplayLength': 50, 'aaSorting': [[1,'desc'], [2,'desc']]" ); ?>
Hope that some one out there can find this useful. Again thanks for your support Tobias.
Regards
Martin Lynge
Hi,
yes, totally right. The closing bracket ] basically ends the Shortcode, so that WordPress doesn’t recognize all parameters.
Unfortunately I don’t know a solution for that, as the ] can not be escaped. There’s also no other character that can be used like it was possible with the ‘ and “.
So, good that you found the solution with the Template Tag. It’s not as nice as the Shortcode, but it works 🙂
Best wishes,
Tobias