Title: Shortcode to call table cell data
Last modified: August 20, 2016

---

# Shortcode to call table cell data

 *  Resolved [Bloggorus](https://wordpress.org/support/users/bloggorus/)
 * (@bloggorus)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/shortcode-to-call-table-cell-data/)
 * I found the shortcode from this WP Table Reloaded thread very useful –>
 * [http://wordpress.org/support/topic/wp-table-reloaded-can-i-reference-another-cell](http://wordpress.org/support/topic/wp-table-reloaded-can-i-reference-another-cell)
 * I would like to modify it to work with Tablepress. Is it as simple as updating
   the global variable to what Tablepress uses?
 * Code below, thanks in advance
 *     ```
       <?php
   
       // handle [table_cell id=123 c=4 r=5 /]
       function shortcode_handler_table_cell( $atts ) {
         global $WP_Table_Reloaded_Frontend;  
   
         $atts = shortcode_atts( array( 'id' => 0, 'c' => 0, 'r' => 0 ), $atts );
         $table_id = $atts['id'];
         $column = $atts['c'] - 1; // subtract 1 because of different array index
         $row = $atts['r'] - 1; // subtract 1 because of different array index
   
         $table = $WP_Table_Reloaded_Frontend->load_table( $table_id );
         $cell_content = $table['data'][$row][$column];
         $render = $WP_Table_Reloaded_Frontend->create_class_instance( 'WP_Table_Reloaded_Render', 'render.class.php' );
         return do_shortcode( $render->safe_output( $cell_content ) );
       }
       add_shortcode( 'table_cell', 'shortcode_handler_table_cell' );
       ?>
       ```
   
 * [http://wordpress.org/extend/plugins/tablepress/](http://wordpress.org/extend/plugins/tablepress/)

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

 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/shortcode-to-call-table-cell-data/#post-3245742)
 * Hi,
 * thanks for your post.
 * As this has been asked recently, I will also create an Extension for this over
   the weekend. Unfortunately, it’s not as easy as just replacing the variables,
   but not that much harder.
    I hope to have it ready early next week.
 * Regards,
    Tobias
 *  Thread Starter [Bloggorus](https://wordpress.org/support/users/bloggorus/)
 * (@bloggorus)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/shortcode-to-call-table-cell-data/#post-3245795)
 * thanks tobias, no rush 🙂
 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/shortcode-to-call-table-cell-data/#post-3245804)
 * Hi,
 * no problem! 🙂
    I have the solution in my head, I just need to write down the
   code this weekend 🙂 I will post instructions here, then.
 * Regards,
    Tobias
 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/shortcode-to-call-table-cell-data/#post-3245818)
 * Hi,
 * good news! The Extension is ready 🙂
 * Just install and activate [https://github.com/downloads/TobiasBg/TablePress-Extensions/tablepress-single-cell-shortcode.zip](https://github.com/downloads/TobiasBg/TablePress-Extensions/tablepress-single-cell-shortcode.zip)
   as a regular WordPress plugin.
    After that, you can use the Shortcode
 *     ```
       [table-cell id=123 cell="B5" /]
       ```
   
 * to get the content of a single cell (in this case of cell B5 from the table with
   the ID 123). If you prefer a different syntax, you can use
 *     ```
       [table-cell id=123 column=2 row=5 /]
       ```
   
 * to get the same.
 * Best wishes,
    Tobias
 *  Thread Starter [Bloggorus](https://wordpress.org/support/users/bloggorus/)
 * (@bloggorus)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/shortcode-to-call-table-cell-data/#post-3245841)
 * many thanks tobias, just implemented it and it works perfectly.
 * My ultra-simple shopping cart is up and running
 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/shortcode-to-call-table-cell-data/#post-3245842)
 * Hi,
 * very nice, thanks for the confirmation! 🙂
 * Best wishes,
    Tobias
 * P.S.: In case you haven’t, please rate the plugin here in the plugin directory.
   Thanks!
 *  [rapidx](https://wordpress.org/support/users/rapidx/)
 * (@rapidx)
 * [13 years, 2 months ago](https://wordpress.org/support/topic/shortcode-to-call-table-cell-data/#post-3245853)
 * Does this plugin still exist TobiasBg? I am trying to get data from a Tablepress
   table through php. Is it possible without a shortcode?
 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [13 years, 2 months ago](https://wordpress.org/support/topic/shortcode-to-call-table-cell-data/#post-3245854)
 * Hi,
 * thanks for your question. Yes, this Extension still exists, it’s just no longer
   directly hosted on GitHub (as GitHub removed that option).
    You can now find 
   it at [http://tablepress.org/extensions/table-cell-shortcode/](http://tablepress.org/extensions/table-cell-shortcode/)
   The source code should give you ideas about how to access a table with PHP.
 * Regards,
    Tobias
 *  [jaymccormick](https://wordpress.org/support/users/jaymccormick/)
 * (@jaymccormick)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/shortcode-to-call-table-cell-data/#post-3245858)
 * Tobias,
 * Just wondering if I could some use a global variable on ONE page – associated
   with an href – to call another page that contained the actual TablePress table,
   as use the filter extension with a variable in it to then show the table only
   with that filter results. Basically click on a link or button that says ‘blah’
   on it, then open another wordpress page with a tablepress table in it that only
   displays rows that say ‘blah’. Sounds simple, but fairly new to wordpress. I 
   am voluntering for a non-profit to assist them.
 * Can you tell me simply or direct me to an article or how-to on that? Thanks.
 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/shortcode-to-call-table-cell-data/#post-3245859)
 * Hi,
 * thanks for your question.
 * This sounds like a perfect scenario for the TablePress Row Filter Extension from
   [http://tablepress.org/extensions/row-filter/](http://tablepress.org/extensions/row-filter/)
   in conjunction with the Extension [https://tablepress.org/extensions/shortcode-filter-get-parameter/](https://tablepress.org/extensions/shortcode-filter-get-parameter/)
 * Regards,
    Tobias

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

The topic ‘Shortcode to call table cell data’ 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
 * 4 participants
 * Last reply from: [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * Last activity: [12 years, 10 months ago](https://wordpress.org/support/topic/shortcode-to-call-table-cell-data/#post-3245859)
 * Status: resolved