コード例 #1
0
 function format_value($value, $post_id, $field)
 {
     if ($field['return_format'] == 'table_id') {
         return $value;
     }
     if ($field['return_format'] == 'rendered_html') {
         if (!function_exists('tablepress_get_table')) {
             return 'TablePress must be enabled';
         }
         $value = tablepress_get_table(array('id' => $value));
         return $value;
     }
 }
コード例 #2
0
 /**
  * Handle Shortcode [table-chart id=<ID> /] in `the_content()`.
  *
  * @since 0.6
  *
  * @param array $shortcode_atts List of attributes that where included in the Shortcode.
  * @return string Generated HTML code for the chart with the ID <ID>.
  */
 public static function handle_table_chart_shortcode($shortcode_atts)
 {
     // Generate the attribute query array for the template tag function.
     $table_query = array('chartist' => true);
     // Pass all parameters to the template tag parameters.
     foreach ((array) $shortcode_atts as $attribute => $value) {
         // Prepend 'chartist_' to all Shortcode attributes that the Extension understands.
         if (isset(self::$shortcode_attributes[$attribute])) {
             $attribute = 'chartist_' . $attribute;
         }
         $table_query[$attribute] = $value;
     }
     return tablepress_get_table($table_query);
 }
コード例 #3
0
/**
 * Add template tag function for "table" Shortcode to be used anywhere in the template, echoes the table HTML
 *
 * This function provides a possibility to show a table anywhere in a WordPress template,
 * which is needed for any region of a theme that can not use Shortcodes.
 *
 * @since 1.0.0
 *
 * @see tablepress_get_table
 * @param string|array $table_query Query string like list or array of parameters for Shortcode "table" rendering
 */
function tablepress_print_table($table_query)
{
    echo tablepress_get_table($table_query);
}