Title: Single Cell Content Shortcode: Display random cell?
Last modified: April 26, 2018

---

# Single Cell Content Shortcode: Display random cell?

 *  Resolved [bjarnee](https://wordpress.org/support/users/bjarnee/)
 * (@bjarnee)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/single-cell-content-shortcode-display-random-cell/)
 * The “Single Cell Content Shortcode” extension is awesome, but it would be even
   awesomer if it was possible do display random cells from a column. Any way to
   add this?

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

 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/single-cell-content-shortcode-display-random-cell/#post-10220876)
 * Hi,
 * thanks for your question, and sorry for the trouble.
 * Sorry, I don’t have a readily available solution for this, but you could e.g.
   look at [https://tablepress.org/extensions/random-row/](https://tablepress.org/extensions/random-row/)
   for some ideas on how to adjust the code.
 * Regards,
    Tobias
 *  Thread Starter [bjarnee](https://wordpress.org/support/users/bjarnee/)
 * (@bjarnee)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/single-cell-content-shortcode-display-random-cell/#post-10220890)
 * Thanks for replying! I don’t know how to program, but if it would help, I could
   donate $30-40 for this!
 * I use another wordpress plugin called “random text”, but I would rather use only
   tablepress, since that plugin is seems not to be updated more.
 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/single-cell-content-shortcode-display-random-cell/#post-10221008)
 * Hi,
 * extending the Single Cell Shortcode Extension is actually not too difficult here.
 * Just change line 40 from
 *     ```
       $row = absint( $shortcode_atts['row'] );
       ```
   
 * to
 *     ```
       if ( 'random' === $shortcode_atts['row'] ) {
         $shortcode_atts['row'] = rand( 1, count( $table['data'] ) );
       }
       $row = absint( $shortcode_atts['row'] );
       ```
   
 * After that, you could use a Shortcode like
 *     ```
       [table-cell id=123 row=random column=3 /]
       ```
   
 * to get a random cell from column 3.
 * Regards,
    Tobias
 *  Thread Starter [bjarnee](https://wordpress.org/support/users/bjarnee/)
 * (@bjarnee)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/single-cell-content-shortcode-display-random-cell/#post-10221126)
 * Awesome! You just replaced this plugin for me:
    [https://wordpress.org/plugins/randomtext/](https://wordpress.org/plugins/randomtext/)
 * As a humble thank you:
 *     ```
       You've authorized a 3,00 USD monthly donation to 
       #####.tablepress.###
       ```
   
    -  This reply was modified 8 years, 1 month ago by [bjarnee](https://wordpress.org/support/users/bjarnee/).
 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/single-cell-content-shortcode-display-random-cell/#post-10221384)
 * Hi,
 * no problem, you are very welcome! 🙂 Good to hear that this helped!
 * And thanks for the donation, I really appreciate this!
 * Best wishes,
    Tobias
 * P.S.: In case you haven’t, please [rate TablePress](https://wordpress.org/support/plugin/tablepress/reviews/#new-post)
   here in the plugin directory. Thanks!

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

The topic ‘Single Cell Content Shortcode: Display random cell?’ 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/)

 * 5 replies
 * 2 participants
 * Last reply from: [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * Last activity: [8 years, 1 month ago](https://wordpress.org/support/topic/single-cell-content-shortcode-display-random-cell/#post-10221384)
 * Status: resolved