PluginProbe
TablePress – Tables in WordPress made easy / 1.14
TablePress – Tables in WordPress made easy v1.14
3.3.4 3.3.3 3.3.2 3.3.1 trunk 1.12 1.14 1.9.2 2.0.4 2.1.7 2.1.8 2.2 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.3 2.3.1 2.3.2 2.4 2.4.1 2.4.2 2.4.3 2.4.4 All 44 releases
tablepress / controllers / template-tag-functions.php

template-tag-functions.php in TablePress – Tables in WordPress made easy 1.14, at controllers/template-tag-functions.php

79 lines 2.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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