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

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;
}
?>