Title: Template Tag Functions
Author: Tobias Bäthge
Published: December 2, 2012
Last modified: May 14, 2025

---

Back to: [Frequently Asked Questions](https://tablepress.org/faq/?output_format=md)•
[Documentation](https://tablepress.org/documentation/?output_format=md)

# Template Tag Functions

To show a table in places not covered by blocks or Shortcodes, e.g. in your page
footer or in the sidebar, you can use the Template Tag Function `tablepress_print_table(
$query );`. It can be added to any part of your theme (between PHP brackets: `<?
php` and `?>`).

The parameter `$query` can be a string in the form of a query string in a URL or
it can be a an array with the query parameters and values.

If you don’t want to immediately print the table, but just get the output, use `
tablepress_get_table( $query );`, which works the same way.

See the [Configuration parameter reference](https://tablepress.org/faq/configuration-parameter-reference/)
for a list of available parameters.

Example with `$query` as a string:

    ```php
    <?php tablepress_print_table( 'id=1&use_datatables=true&print_name=false' ); ?>Code language: PHP (php)
    ```

Example with `$query` as an array (recommended and easier to read):

    ```php
    <?php tablepress_print_table( array(
      'id' => '1',
      'use_datatables' => true,
      'print_name' => false,
    ) ); ?>Code language: PHP (php)
    ```

There’s a also a Template Tag Function for the Shortcode

    ```language-plaintext
    [table-info id=N field="<field-name>" /]Code language: plaintext (plaintext)
    ```

available:

    ```php
    <?php tablepress_print_table_info( "id=1&field=name" ); ?>Code language: PHP (php)
    ```

or

    ```php
    <?php tablepress_print_table_info( array(
      'id' => '1',
      'field' => 'name',
    ) ); ?>Code language: PHP (php)
    ```

It works exactly as the Template Tag Function described above, with the parameters
from the section about the `[table-info /]` Shortcode.