Files
WORDPRESS_PLUGIN_model/plugins/fipf_wp_plugin/fipf_wp_hooks.php
2024-02-08 12:11:16 +01:00

78 lines
1.5 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() {
# send styles files by name, without extension .css
add_css_to_front( array(
"mystyle",
));
# send scripts files by name, without extension .js
add_scripts_to_front( array(
"myscript",
"myscript2",
"myscript3",
));
$myvar_1 = "I am one";
$myvar_2 = "I am two";
# maybe a future version of php will allow to
# get the name of a variable :
# https://wiki.php.net/rfc/nameof
# but for now i have to declare both the variable and its name
# (more : https://stackoverflow.com/q/255312/9497573)
add_var_to_front( array(
"myvar_1" => $myvar_1,
"myvar_2" => $myvar_2,
));
return create_html( array(
"index.html",
"index2.html",
));
}
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');
?>