Title: shortcode for rows per page
Last modified: April 25, 2018

---

# shortcode for rows per page

 *  Resolved [eleonoli](https://wordpress.org/support/users/eleonoli/)
 * (@eleonoli)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/shortcode-for-rows-per-page/)
 * Hi,
 * Is it possible to use shortcode for showing only last 10 rows of table (if pagination
   is not enabled in the DataTables JavaScript library)?
 * Thanks!

Viewing 1 replies (of 1 total)

 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/shortcode-for-rows-per-page/#post-10217109)
 * Hi,
 * thanks for your post, and sorry for the trouble.
 * The only solution that I can think of right now is to define a custom Shortcode.
   For that, please add this to your theme’s functions.php file:
 *     ```
       add_shortcode( 'table-last-ten-rows', 'tablepress_last_ten_rows_shortcode' );
       function tablepress_last_ten_rows_shortcode( $atts ) {
         $number_table_rows = tablepress_get_table_info( array( 'id' => $atts['id'], 'field' => 'number_rows' ) );
         $atts['hide_rows] = '1-' . ( $number_table_rows - 10 );
         return tablepress_get_table( $atts );
       }
       ```
   
 * Now, you can use a Shortcode like
 *     ```
       [table-last-ten-rows id=123 /]
       ```
   
 * Regards,
    Tobias

Viewing 1 replies (of 1 total)

The topic ‘shortcode for rows per page’ 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/)

## Tags

 * [pagination](https://wordpress.org/support/topic-tag/pagination/)
 * [rows](https://wordpress.org/support/topic-tag/rows/)
 * [shortcode](https://wordpress.org/support/topic-tag/shortcode/)

 * 1 reply
 * 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/shortcode-for-rows-per-page/#post-10217109)
 * Status: resolved