Support » Plugin: TablePress - Tables in WordPress made easy » [Plugin: TablePress] Global settings

  • Resolved mvhoute

    (@mvhoute)


    I don’t really have a support question, more a wish for future versions.

    I’m using Tablepress to display +/- 35 tables on a website. It would be a real timesaver if I can globally change the table options & features of the datatables Javascript library, in stead of changing the settings for each individual table.

    Is it possible to overrule the current settings for all tables?

    http://wordpress.org/extend/plugins/tablepress/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    thanks a lot for your post!

    Changing these globally is not possible (and likely won’t be in the future), unfortunately.

    Instead, I suggest that you use a plugin filter hook, to set these globally. For that, there are actually tho approaches: You could use a hook to change the default states of these options, so that for example all new tables (but not existing tables) will have DataTables turned off. Or you could use a hook to override the states of the checkboxes when the table is shown. This could look like this:

    add_filter( 'tablepress_table_render_options', 'tablepress_override_table_options', 10, 2 );
    function tablepress_override_table_options( $render_options, $table ) {
      $render_options['use_datatables'] = false;
      $render_options['alternating_row_colors'] = false;
    }

    This would deactivate DataTables for all tables, and it would turn off the “Alternating Row Colors”, in both times regardless of what the checkbox on the table’s “Edit” screen is set to.

    To use this code, just paste it into your theme’s “functions.php”, or create a small plugin for it.
    (Note: This will require TablePress 0.7-beta (or the current master branch version from GitHub), as I noticed that I have to make a code change first, to make this this easy 🙂 )

    Regards,
    Tobias

    Small update here – in case somebody else comes here looking for this. That filter function needs a

    return $render_options;

    in the end, otherwise it’ll just break your rendering options.

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    oops, that’s embarrassing. Thanks for catching this, Mikko!

    Best wishes,
    Tobias

    Thread Starter mvhoute

    (@mvhoute)

    Maybe a bit too late, but still: thanks for the solution!

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    no problem, you are very welcome! 🙂

    Best wishes,
    Tobias

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Plugin: TablePress] Global settings’ is closed to new replies.