- start a basic plugin that can send code to front
- for the moment it send js scripts, css, and variables
This commit is contained in:
@@ -8,14 +8,50 @@ Version: 1.1.0
|
||||
Author URI:
|
||||
*/
|
||||
|
||||
include_once(dirname(__FILE__) . '/utils/consolelog.php');
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* inclusions
|
||||
*/
|
||||
|
||||
include_once(dirname(__FILE__) . '/utils/console_log.php');
|
||||
include_once(dirname(__FILE__) . '/utils/add_to_front.php');
|
||||
|
||||
|
||||
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* plugin shortcode
|
||||
*/
|
||||
|
||||
function main_shortcode() {
|
||||
|
||||
consolelog("hello from php");
|
||||
# send styles files by name, without extension .css
|
||||
add_css_to_front( array(
|
||||
"mystyle",
|
||||
));
|
||||
|
||||
# send scripts files by name, without extension .js
|
||||
add_script_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,
|
||||
));
|
||||
|
||||
}
|
||||
add_shortcode('fipf_wp_plugin', 'main_shortcode');
|
||||
|
||||
|
||||
?>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user