Title: adding  wrapper around table in tablepress
Last modified: August 21, 2016

---

# adding wrapper around table in tablepress

 *  Resolved [radula](https://wordpress.org/support/users/radula/)
 * (@radula)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/adding-wrapper-around-table-in-tablepress/)
 * I want to add a wrapper around table in tablepress, Where can i modify the code
   for doing this.
 * [https://wordpress.org/plugins/tablepress/](https://wordpress.org/plugins/tablepress/)

Viewing 10 replies - 1 through 10 (of 10 total)

 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/adding-wrapper-around-table-in-tablepress/#post-5139482)
 * Hi,
 * thanks for your question, and sorry for the trouble.
 * The best way for that should be to use a the `tablepress_render_output` filter
   hook. With that, you can use code like
 *     ```
       add_filter( 'tablepress_table_output', 'tp_add_wrapper', 10, 3 );
       function tp_add_wrapper( $output, $table, $render_options ) {
         $output = "<div class=\"tablepress-wrapper\">\n{$output}\n</div>";
         return $output;
       }
       ```
   
 * e.g. in your theme’s functions.php or a small new plugin file. That way you don’t
   have to modify the TablePress plugin files, as you would lose those changes after
   a plugin update.
 * Regards,
    Tobias
 *  Thread Starter [radula](https://wordpress.org/support/users/radula/)
 * (@radula)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/adding-wrapper-around-table-in-tablepress/#post-5139490)
 * Sorry for asking again,I want to add wrapper just around the table, so that i
   can border the table.
 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/adding-wrapper-around-table-in-tablepress/#post-5139497)
 * Hi,
 * ok, I might not be understanding what you mean then.
    This will add a wrapping`
   <div>` element around the table. Is that now what you want?
 * Or do you only want a border around your table? Can you please post a link to
   the page with the table where this problem happens, so that I can take a direct
   look? Thanks!
 * Regards,
    Tobias
 *  Thread Starter [radula](https://wordpress.org/support/users/radula/)
 * (@radula)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/adding-wrapper-around-table-in-tablepress/#post-5139609)
 * URL: [http://cyberbel.com/](http://cyberbel.com/)
    I had inserted the code in
   functions.php, but it was wrapping ‘dataTables_wrapper’ container not just the
   table. Instead I want to wrap around the table, so that i can apply border around
   the table wrapper.
 * Presently the code looks like:
    _**<div class=”tablepress-wrapper2″>**_
 * <div id=”tablepress-devTools_wrapper” class=”dataTables_wrapper” role=”grid”>
   <div id=”tablepress-devTools_length” class=”dataTables_length”><label>Show <select
   size=”1″ name=”tablepress-devTools_length” aria-controls=”tablepress-devTools”
   ><option value=”10″ selected=”selected”>10</option><option value=”25″>25</option
   ><option value=”50″>50</option><option value=”100″>100</option></select> entries
   </label></div><div class=”dataTables_filter” id=”tablepress-devTools_filter”>
   <label>Search: <input type=”text” aria-controls=”tablepress-devTools”></label
   ></div><table id=”tablepress-devTools”
 * Instead I was expecting, tablepress-wrapper2 to wrap around table tag
 *  Thread Starter [radula](https://wordpress.org/support/users/radula/)
 * (@radula)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/adding-wrapper-around-table-in-tablepress/#post-5139610)
 * I want to wrap the table so that I can apply border radius to the table.
 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/adding-wrapper-around-table-in-tablepress/#post-5139614)
 * Hi,
 * thanks for the detailed explanations! This won’t work like this, unfortunately.
   The `dataTables_wrapper` container is added on the fly by the DataTables JavaScript
   library, via JavaScript, and because of that, it will always be the direct wrapper
   for the `<table>` element.
 * You would have to tell DataTables to add another wrapper for you, but for a rounded
   border, you should actually not need a wrapper.
    It should be enough to add some“
   Custom CSS” as described in this thread: [http://wordpress.org/support/topic/can-tablepress-do-this?replies=9](http://wordpress.org/support/topic/can-tablepress-do-this?replies=9)
 * By the way: Many links/ressources on your site are being loaded from `localhost`
   instead of the real domain, which means that they will only load for you. You
   should fix that!
 * Regards,
    Tobias
 *  Thread Starter [radula](https://wordpress.org/support/users/radula/)
 * (@radula)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/adding-wrapper-around-table-in-tablepress/#post-5139640)
 * Thanks for the response. The link which you provided would work for me to apply
   border radius. Thanks for finding the ‘localhost’ link issue, I missed noticing
   them.
 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/adding-wrapper-around-table-in-tablepress/#post-5139641)
 * Hi,
 * no problem, you are very welcome! 🙂 Good to hear that this helped!
 * Best wishes,
    Tobias
 * P.S.: In case you haven’t, please [rate TablePress](https://wordpress.org/support/view/plugin-reviews/tablepress)
   here in the plugin directory. Thanks!
 *  [Break5](https://wordpress.org/support/users/break5/)
 * (@break5)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/adding-wrapper-around-table-in-tablepress/#post-5139730)
 * Thanks for the snippet, Tobias
 * As mentioned it only works with javascript enabled for the table
 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/adding-wrapper-around-table-in-tablepress/#post-5139731)
 * Hi,
 * can you clarify? The code from my first reply does not need the JS library to
   be enabled.
 * Regards,
    Tobias

Viewing 10 replies - 1 through 10 (of 10 total)

The topic ‘adding wrapper around table in tablepress’ is closed to new replies.

 * ![](https://ps.w.org/tablepress/assets/icon.svg?rev=3192944)
 * [TablePress - Tables in WordPress made easy](https://wordpress.org/plugins/tablepress/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/tablepress/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/tablepress/)
 * [Active Topics](https://wordpress.org/support/plugin/tablepress/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/tablepress/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/tablepress/reviews/)

 * 10 replies
 * 3 participants
 * Last reply from: [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * Last activity: [11 years, 1 month ago](https://wordpress.org/support/topic/adding-wrapper-around-table-in-tablepress/#post-5139731)
 * Status: resolved