add_files_to_front( array( "example_style.css", "example_init.js", "example_script2.js", "example_script3.js", )); $myvar_1 = "I am one"; $myvar_2 = "I am two"; $fipfcard_tools->add_var_to_front( compact( "myvar_1", "myvar_2", )); $names = ["hugo", "camille"]; $ages = ["13", "34", "56"]; $getPostMeta = get_post_meta( get_the_ID() ); $getMetaData = get_metadata( 'post', get_the_ID() ); $post_meta = $getPostMeta; $getUserMeta = get_metadata( 'user', get_current_user_id() ); $user_meta = $getUserMeta; $html_front = $fipfcard_tools->create_html( array( "example_index.html", "example_index2.html", ), compact( "post_meta", "user_meta", "names", "ages", ) ); return $html_front; } add_shortcode('fipfcard_plugin', 'fipfcard_main_shortcode'); /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * menu plugin */ function fipfcard_plugin_menu() { add_menu_page( 'fipf_card', // webpage title 'fipf_card', // menu title 'manage_options', // capability 'fipfcard-plugin', // menu_slug 'fipfcard_plugin_content' // callback function to display page content ); } add_action('admin_menu', 'fipfcard_plugin_menu'); /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ajax - https://stackoverflow.com/questions/43557755/how-to-call-ajax-in-wordpress - in `add_action( 'wp_ajax_get_data', 'my_ajax_handler' );` the 'wp_ajax_get_data' is a hooks formated as 'wp_ajax_{$action}' the `$action` param is passed in the data object of the ajax call - to access the content of the data object properties of the ajax call : use $_POST['property_name'] */ function fipfcard_ajax_handler() { wp_send_json_success( array( 'It works', "data_received" => $_POST['data'], ), 200 ); } add_action( 'wp_ajax_get_data', 'fipfcard_ajax_handler' ); ?>