コード例 #1
0
                     */
                    vc_map( 
                        array(
                            'name' => 'wpDataTable',
                            'base' => 'wpdatatable',
                            'description' => __('Interactive Responsive Table','wpdatatable'),
                            'category' => __('Content'),
                            'icon' => plugin_dir_url( dirname( __FILE__ ) ).'/assets/img/vc-icon.png',
                            'params' => array(
                               array(
                                  'type' => 'dropdown',
                                  'class' => '',
                                  'heading' => __('wpDataTable', 'wpdatatables'),
		                          'admin_label' => true,
                                  'param_name' => 'id',
                                  'value' => wdt_get_all_tables_vc(),
                                  'description' => __('Choose the wpDataTable from a dropdown', 'wpdatatables')
                               ),
                               array(
                                     'type' => 'textfield',
                                     'heading' => __('Variable placeholder #1', 'wpdatatables'),
                                     'param_name' => 'var1',
                                     'value' => '',
                                     'group' => __( 'Variables', 'wpdatatables' ),
                                     'description' => __( 'If you used the VAR1 placeholder you can assign a value to it here', 'wpdatatables' )
                               ),
                               array(
                                     'type' => 'textfield',
                                     'heading' => __('Variable placeholder #2', 'wpdatatables'),
                                     'param_name' => 'var2',
                                     'value' => '',
コード例 #2
0
        $query = "SELECT id, title\n                                                FROM {$wpdb->prefix}wpdatatables ORDER BY id";
        $all_tables = $wpdb->get_results($query, ARRAY_A);
        $return_tables = array();
        foreach ($all_tables as $table) {
            $return_tables[$table['title']] = $table['id'];
        }
        return $return_tables;
    }
    /**
     * Get all charts non-paged for the Visual Composer integration
     */
    function wdt_get_all_charts_vc()
    {
        global $wpdb;
        $query = "SELECT id, title\n                                                FROM {$wpdb->prefix}wpdatacharts ORDER BY id";
        $all_charts = $wpdb->get_results($query, ARRAY_A);
        $return_tables = array();
        foreach ($all_charts as $chart) {
            $return_tables[$chart['title']] = $chart['id'];
        }
        return $return_tables;
    }
    /**
     * Insert wpDataTable button
     */
    vc_map(array('name' => 'wpDataTable', 'base' => 'wpdatatable', 'description' => __('Interactive Responsive Table', 'wpdatatable'), 'category' => __('Content'), 'icon' => plugin_dir_url(dirname(__FILE__)) . '/assets/img/vc-icon.png', 'params' => array(array('type' => 'dropdown', 'class' => '', 'heading' => __('wpDataTable', 'wpdatatables'), 'admin_label' => true, 'param_name' => 'id', 'value' => wdt_get_all_tables_vc(), 'description' => __('Choose the wpDataTable from a dropdown', 'wpdatatables')), array('type' => 'textfield', 'heading' => __('Variable placeholder #1', 'wpdatatables'), 'param_name' => 'var1', 'value' => '', 'group' => __('Variables', 'wpdatatables'), 'description' => __('If you used the VAR1 placeholder you can assign a value to it here', 'wpdatatables')), array('type' => 'textfield', 'heading' => __('Variable placeholder #2', 'wpdatatables'), 'param_name' => 'var2', 'value' => '', 'group' => __('Variables', 'wpdatatables'), 'description' => __('If you used the VAR2 placeholder you can assign a value to it here', 'wpdatatables')), array('type' => 'textfield', 'heading' => __('Variable placeholder #3', 'wpdatatables'), 'param_name' => 'var3', 'value' => '', 'group' => __('Variables', 'wpdatatables'), 'description' => __('If you used the VAR3 placeholder you can assign a value to it here', 'wpdatatables')))));
    /**
     * Insert wpDataChart button
     */
    vc_map(array('name' => 'wpDataChart', 'base' => 'wpdatachart', 'description' => __('Google or Highcharts chart based on a wpDataTable', 'wpdatatable'), 'category' => __('Content'), 'icon' => plugin_dir_url(dirname(__FILE__)) . '/assets/img/vc-charts-icon.png', "params" => array(array("type" => "dropdown", "class" => "", "heading" => __('wpDataChart', 'wpdatatables'), "param_name" => "id", 'admin_label' => true, "value" => wdt_get_all_charts_vc(), "description" => __("Choose one of wpDataCharts from the list", 'wpdatatables')))));
}