load css re js not working
-
In a personal class I’m trying to load css and js, but it doesn’t work.
This is the class<?php
namespace test_name;
class All_name_page{
function __construct()
{
add_action( 'wp_enqueue_scripts', 'my_assets' );
}
function index($data){
$content = '<h1>All ex-alunni page</h1><br>';
$content.='<table>';
$content.= '<tr><td>Name</td></th>';
foreach ($data as $key=>$ea){
$content.= '<tr>';
$content.= '<td>'.$ea->Name.'</td>';
$content.='</tr>';
}
$content.='</table>';
return $content;
}
function my_assets() {
wp_register_style( 'datatables-css', plugin_url('//cdn.datatables.net/v/dt/dt-2.1.3/datatables.min.css'),array(), 'false','true');
wp_register_script( 'datatables-js', '//cdn.datatables.net/v/dt/dt-2.1.3/datatables.min.js', array('jquery'),'false','true');
}
}
?>
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘load css re js not working’ is closed to new replies.