now we can add attributes to js files using the tools class

This commit is contained in:
asus
2024-02-27 15:23:07 +01:00
parent 7a8c0750c5
commit 2ce603e644
8 changed files with 217 additions and 107 deletions

View File

@@ -11,7 +11,8 @@ function fipfcard_plugin_content() {
$fipfcard = new PLGNTLS_class();
echo $fipfcard->add_to_front( array(
"js/menu/example_menu.js",
array("js/menu/example_menu.js", 'type'=>'module'),
"js/menu/example_menu_2.js",
"html/menu/example_menu.html",
));
}
@@ -27,7 +28,7 @@ ajax
- to access the content of the data object properties of the ajax call :
use $_POST['property_name']
*/
function fipfcard_ajax_handler()
function fipfcard_menu_fetch_handler()
{
return new WP_REST_Response('hello', 200);
}
@@ -35,7 +36,7 @@ function fipfcard_menu_endpoint()
{
register_rest_route('plgntls', '/get_data', array(
'methods' => 'POST',
'callback' => 'fipfcard_ajax_handler',
'callback' => 'fipfcard_menu_fetch_handler',
));
};
add_action('rest_api_init', 'fipfcard_menu_endpoint');