Register styles
-
Can someone tell me why this isnt working?
In short, its just a shorcode to get some data in a table using jqwidgets.
it works fine standalone but i cant get it to work throu wordpress.function get_shortcode_ollo() { wp_register_style( 'stylesheet', plugins_url('jqwidgets/styles/jqx.base.css', __FILE__), false, '', 'all'); wp_enqueue_style('datatables_style'); wp_register_style( 'stylesheet', plugins_url('jqwidgets/styles/jqx.metro.css', __FILE__), false, '', 'all'); wp_enqueue_style('datatables_style'); wp_register_script('jquery', plugin_dir_url(__FILE__) . 'scripts/jquery-1.10.2.min.js', 'jquery', '1.10.2', false); wp_enqueue_script('jquery'); wp_register_script('jquery1', plugin_dir_url(__FILE__) . 'jqwidgets/jqxcore.js', 'jqwidgets', '', false); wp_enqueue_script('jquery1'); wp_register_script('jquery2', plugin_dir_url(__FILE__) . 'jqwidgets/jqxbuttons.js', 'jqwidgets', '', false); wp_enqueue_script('jquery2'); wp_register_script('jquery3', plugin_dir_url(__FILE__) . 'jqwidgets/jqxscrollbar.js', 'jqwidgets', '', false); wp_enqueue_script('jquery3'); wp_register_script('jquery4', plugin_dir_url(__FILE__) . 'jqwidgets/jqxmenu.js', 'jqwidgets', '', false); wp_enqueue_script('jquery4'); wp_register_script('jquery5', plugin_dir_url(__FILE__) . 'jqwidgets/jqxgrid.js', 'jqwidgets', '', false); wp_enqueue_script('jquery5'); wp_register_script('jquery6', plugin_dir_url(__FILE__) . 'jqwidgets/jqxgrid.selection.js', 'jqwidgets', '', false); wp_enqueue_script('jquery6'); wp_register_script('jquery7', plugin_dir_url(__FILE__) . 'jqwidgets/jqxgrid.filter.js', 'jqwidgets', '', false); wp_enqueue_script('jquery7'); wp_register_script('jquery8', plugin_dir_url(__FILE__) . 'jqwidgets/jqxgrid.sort.js', 'jqwidgets', '', false); wp_enqueue_script('jquery8'); wp_register_script('jquery9', plugin_dir_url(__FILE__) . 'jqwidgets/jqxdata.js', 'jqwidgets', '', false); wp_enqueue_script('jquery9'); wp_register_script('jquerya', plugin_dir_url(__FILE__) . 'jqwidgets/jqxlistbox.js', 'jqwidgets', '', false); wp_enqueue_script('jquerya'); wp_register_script('jqueryb', plugin_dir_url(__FILE__) . 'jqwidgets/jqxgrid.pager.js', 'jqwidgets', '', false); wp_enqueue_script('jqueryb'); wp_register_script('jqueryc', plugin_dir_url(__FILE__) . 'jqwidgets/jqxdropdownlist.js', 'jqwidgets', '', false); wp_enqueue_script('jqueryc'); /** wp_register_script('jqueryd', plugin_dir_url(__FILE__) . 'skript.js', 'jqwidgets', '', false); wp_enqueue_script('jqueryd'); */ $skr = '<script type="text/javascript"> $(document).ready(function () { // prepare the data var theme = \'metro\'; var source = { datatype: "json", datafields: [ { name: \'cTrackName\', type: \'string\'}, { name: \'cLapNumber\', type: \'string\'}, { name: \'cLapTime\', type: \'string\'}, { name: \'cContender\', type: \'string\'}, { name: \'cDate\', type: \'string\'} ], url: \'data.php\', cache: false, filter: function() { // update the grid and send a request to the server. $("#jqxgrid").jqxGrid(\'updatebounddata\', \'filter\'); }, sort: function() { // update the grid and send a request to the server. $("#jqxgrid").jqxGrid(\'updatebounddata\', \'sort\'); }, root: \'Rows\', beforeprocessing: function(data) { if (data != null) { source.totalrecords = data[0].TotalRows; } } }; var dataadapter = new $.jqx.dataAdapter(source, { loadError: function(xhr, status, error) { alert(error); } } ); // initialize jqxGrid $("#jqxgrid").jqxGrid( { source: dataadapter, theme: theme, filterable: true, sortable: true, autoheight: true, pageable: true, virtualmode: true, rendergridrows: function(obj) { return obj.data; }, columns: [ { text: \'Track\', datafield: \'cTrackName\', cellsformat: \'yyyy-MM-dd\', width: 200 }, { text: \'Lap\', datafield: \'cLapNumber\', width: 200 }, { text: \'Time\', datafield: \'cLapTime\', width: 180 }, { text: \'Contender\', datafield: \'cContender\', width: 100 }, { text: \'Date\', datafield: \'cDate\', width: 140 } ] }); }); </script>'; $sko = ' <div id="jqxWidget"> <div id="jqxgrid"></div> </div> '; return $sko . $skr; ; } add_shortcode('ollo_code', 'get_shortcode_ollo'); ?>
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
The topic ‘Register styles’ is closed to new replies.