Files
2024_WEBSITE_fipf/plugins/fipf_wp_plugin/fipf_wp_hooks.php

81 lines
1.4 KiB
PHP

<?php
/*
Plugin Name: fipf_wp_plugin
Plugin URI:
Description:
Author: hugogogo
Version: 1.1.0
Author URI:
*/
/* * * * * * * * * * * * * * * * * * * * * * * *
* inclusions
*/
include_once(dirname(__FILE__) . '/utils/console_log.php');
include_once(dirname(__FILE__) . '/utils/add_to_front.php');
include_once(dirname(__FILE__) . '/utils/create_html.php');
/* * * * * * * * * * * * * * * * * * * * * * * *
* plugin shortcode
*/
function main_shortcode() {
add_files_to_front( array(
"mystyle.css",
"myscript.js",
"myscript2.js",
"myscript3.js",
));
$myvar_1 = "I am one";
$myvar_2 = "I am two";
# compact creates an array containing the variables and their value
# as key => value
# from an array of variables names as strings
add_var_to_front( compact(
"myvar_1",
"myvar_2",
));
$names = ["hugo", "camille"];
$ages = ["13", "34", "56"];
$html_front = create_html(
array(
"index.html",
"index2.html",
),
compact(
"names",
"ages",
)
);
return $html_front;
}
add_shortcode('fipf_wp_plugin', 'main_shortcode');
/* * * * * * * * * * * * * * * * * * * * * * * *
* menu plugin
*/
function plugin_menu() {
add_menu_page(
'FIPF wp plugin', // webpage title
'FIPF', // menu title
'manage_options', // capability
'fipf-wp-plugin', // menu_slug
'fipf_wp_plugin_content' // callback function to display page content
);
}
add_action('admin_menu', 'plugin_menu');
?>