I have a problem with my WordPress plugin, I want to insert a Gridster into the plugin, but it does not work.
Here I upload files that are located correctly in the folder.
function add_my_stylesheet() { wp_enqueue_style( 'myCSS', plugins_url( '/css/bootstrap.css', __FILE__ ), false ); wp_enqueue_style("gridster-style", plugins_url( '/css/jquery.gridster.min.css', __FILE__ ), false ); } add_action('admin_print_styles', 'add_my_stylesheet'); function add_my_scripts() { //I tried wp_register_script as well as wp_enqueue_script wp_register_script( "jquery-gridster", plugins_url( '/js/jquery.min.js', __FILE__ ) ); wp_register_script( "gridster-script", plugins_url( '/js/jquery.gridster.min.js', __FILE__ ) ); wp_register_script( "gridster-script-extra", plugins_url( '/js/jquery. gridster.with-extras.min.js', __FILE__ ) ); } add_action( 'wp_register_scripts', 'add_my_scripts' );
And this is an example of expected output code, which, of course, doesn't work either.
echo' <section class="demo"> <div class="gridster"> <ul> <li class="bg-blue" data-row="1" data-col="1" data-sizex="1" data-sizey="1">Box1</li> <li class="bg-pink" data-row="1" data-col="2" data-sizex="1" data-sizey="1">Box2</li> <li class="bg-pink" data-row="1" data-col="3" data-sizex="1" data-sizey="2">Box3</li> </ul> </div> </section> <script type="text/javascript"> var gridster; $(function() { gridtster = $(".gridster > ul").gridster({ widget_margins: [10, 10], widget_base_dimensions: [140, 140], min_cols: 6 }).data("gridster"); }); </script>';
I tried to include it in the header file of the templates, as well as in the plugin, but it shows me only the text, and I can not drag them.