| 1 |
<?php |
| 2 |
/** |
| 3 |
* Frontend Template Tag functions, only available when the Frontend Controller is loaded |
| 4 |
* |
| 5 |
* @package TablePress |
| 6 |
* @subpackage Frontend Template Tag functions |
| 7 |
* @author Tobias Bäthge |
| 8 |
* @since 1.0.0 |
| 9 |
*/ |
| 10 |
|
| 11 |
/** |
| 12 |
* Add template tag function for "table" Shortcode to be used anywhere in the template, returns the table HTML. |
| 13 |
* |
| 14 |
* This function provides a possibility to show a table anywhere in a WordPress template, |
| 15 |
* which is needed for any region of a theme that can not use Shortcodes. |
| 16 |
* |
| 17 |
* @since 1.0.0 |
| 18 |
* |
| 19 |
* @param string|array $table_query Query string like list or array of parameters for Shortcode "table" rendering. |
| 20 |
* @return string HTML of the rendered table. |
| 21 |
*/ |
| 22 |
function tablepress_get_table( $table_query ) { |
| 23 |
if ( is_array( $table_query ) ) { |
| 24 |
$atts = $table_query; |
| 25 |
} else { |
| 26 |
parse_str( (string) $table_query, $atts ); |
| 27 |
} |
| 28 |
return TablePress::$controller->shortcode_table( $atts ); |
| 29 |
} |
| 30 |
|
| 31 |
/** |
| 32 |
* Add template tag function for "table" Shortcode to be used anywhere in the template, echoes the table HTML. |
| 33 |
* |
| 34 |
* This function provides a possibility to show a table anywhere in a WordPress template, |
| 35 |
* which is needed for any region of a theme that can not use Shortcodes. |
| 36 |
* |
| 37 |
* @since 1.0.0 |
| 38 |
* |
| 39 |
* @see tablepress_get_table() |
| 40 |
* |
| 41 |
* @param string|array $table_query Query string like list or array of parameters for Shortcode "table" rendering. |
| 42 |
*/ |
| 43 |
function tablepress_print_table( $table_query ) { |
| 44 |
echo tablepress_get_table( $table_query ); |
| 45 |
} |
| 46 |
|
| 47 |
/** |
| 48 |
* Add template tag function for "table-info" Shortcode to be used anywhere in the template, returns the info. |
| 49 |
* |
| 50 |
* @since 1.0.0 |
| 51 |
* |
| 52 |
* @param string|array $table_query Query string like list or array of parameters for Shortcode "table-info" rendering. |
| 53 |
* @return string Desired table information. |
| 54 |
*/ |
| 55 |
function tablepress_get_table_info( $table_query ) { |
| 56 |
if ( is_array( $table_query ) ) { |
| 57 |
$atts = $table_query; |
| 58 |
} else { |
| 59 |
parse_str( (string) $table_query, $atts ); |
| 60 |
} |
| 61 |
return TablePress::$controller->shortcode_table_info( $atts ); |
| 62 |
} |
| 63 |
|
| 64 |
/** |
| 65 |
* Add template tag function for "table-info" Shortcode to be used anywhere in the template, echoes the info. |
| 66 |
* |
| 67 |
* This function provides a possibility to show table info data anywhere in a WordPress template, |
| 68 |
* which is needed for any region of a theme that can not use Shortcodes. |
| 69 |
* |
| 70 |
* @since 1.0.0 |
| 71 |
* |
| 72 |
* @see tablepress_get_table_info() |
| 73 |
* |
| 74 |
* @param string|array $table_query Query string like list or array of parameters for Shortcode "table-info" rendering. |
| 75 |
*/ |
| 76 |
function tablepress_print_table_info( $table_query ) { |
| 77 |
echo tablepress_get_table_info( $table_query ); |
| 78 |
} |
| 79 |
|