Initial commit

This commit is contained in:
Lewis Dale 2023-01-09 23:37:28 +00:00
commit 8e496a9909
2 changed files with 72 additions and 0 deletions

58
classes/init.php Normal file
View File

@ -0,0 +1,58 @@
<?php
global $enqueued_scripts;
class Lewtilities {
public function __construct()
{
$this->init();
}
public function init() {
add_action('admin_menu', array ( $this, 'submenu_page' ));
add_action('wp_print_styles', array( $this, 'enqueue_styles' ), 9999);
}
public function enqueue_styles() {
global $wp_styles;
global $enqueued_styles;
$enqueued_styles = array();
foreach( $wp_styles->queue as $handle ) {
$enqueued_styles[] = $wp_styles->registered[$handle]->src;
}
print_r($wp_styles->queue);
}
public function submenu_page() {
add_menu_page( 'Lewtilities', 'Lewtilities', 'manage_options', 'lewtilities-main-menu',
array( $this, 'admin_styles' ), '', 84 );
add_submenu_page( 'lewtilities-main-menu', __( 'Dashboard', 'wp-ld' ),
__( 'Dashboard', 'wp-ld' ), 'manage_options',
'lewtilities-main-menu', array( $this, 'admin_styles' ) );
}
public function admin_settings() {
// echo "Settings!";
}
public function admin_styles() {
echo "Admin styles section";
global $enqueued_styles;
echo var_dump($enqueued_styles);
}
public function admin_options_page() {
add_menu_page(
'Lewtilities',
'Lewtilities',
'manage_options',
'lewtilities',
array( $this, 'admin_options_page_display' )
);
}
public function admin_options_page_display() {
echo "Options page";
}
}

14
lewtilities.php Normal file
View File

@ -0,0 +1,14 @@
<?php
/**
* Plugin Name: Lewtilities
* Plugin URI: https://github.com/lewisdaleuk/lewtilities
* Description: A collection of utilities and handy helpers
* Author: Lewis Dale
* Author URI: https://lewisdale.dev
* Version: 1.0.0
* Text Domain: wp-ld
*/
require_once('classes/init.php');
$lewtilities = new Lewtilities();