wip first shortcode

This commit is contained in:
asus
2024-02-07 14:39:22 +01:00
parent 858290a72b
commit e3ae101fdd
3 changed files with 67 additions and 0 deletions

35
Makefile Normal file
View File

@@ -0,0 +1,35 @@
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
# . name = value \ . += append to a variable #
# VARIABLES . value . != set result of command #
# . name is case sensitive . ?= set if not already set #
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
WP_DOCKER_D = ./wordpress_docker
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
# . target: prerequisites . $@ : target #
# RULES . recipe . $< : 1st prerequisite #
# . recipe . $^ : all prerequisites #
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
all:
$(MAKE) $@ -C $(WP_DOCKER_D)
fclean:
$(MAKE) $@ -C $(WP_DOCKER_D)
re:
$(MAKE) $@ -C $(WP_DOCKER_D)
erase:
$(MAKE) $@ -C $(WP_DOCKER_D)
new:
$(MAKE) $@ -C $(WP_DOCKER_D)
.PHONY : all fclean re erase new

View File

@@ -0,0 +1,21 @@
<?php
/*
Plugin Name: fipf_wp_plugin
Plugin URI:
Description:
Author: hugogogo
Version: 1.1.0
Author URI:
*/
include_once(dirname(__FILE__) . '/utils/consolelog.php');
function main_shortcode() {
consolelog("hello from php");
}
add_shortcode('fipf_wp_plugin', 'main_shortcode');
?>

View File

@@ -0,0 +1,11 @@
<?php
// https://stackify.com/how-to-log-to-console-in-php/
function consolelog($output) {
$js_code = 'console.log(' . json_encode($output, JSON_HEX_TAG) . ');';
$js_code = '<script>' . $js_code . '</script>';
echo $js_code;
}
?>