Skip to content

Instantly share code, notes, and snippets.

View shaunpalmer's full-sized avatar

shaun palmer shaunpalmer

View GitHub Profile
@shaunpalmer
shaunpalmer / perf-diagnostics.css
Created September 15, 2024 02:11 — forked from wir/perf-diagnostics.css
CSS used to highlight potential performance issues
:root {
--violation-color: red; /* used for clear issues */
--warning-color: orange; /* used for potential issues we should look into */
}
/* IMAGES */
/*
* Lazy-Loaded Images Check
* ====
The below code is plugin codes used for adding new functionality setup
while updating the plugin or activating the plugin.
This is simple plugin code and it will add transient while updating or activating the plugin.
Clear transient once we finished the operation.
=======================================================================================
<?php
/*Plugin Name: Wordpress Update
@shaunpalmer
shaunpalmer / is_plugin_active.php
Created September 15, 2024 02:23 — forked from wpscholar/is_plugin_active.php
Test if a WordPress plugin is active
<?php
/**
* Test if a WordPress plugin is active
*/
if ( is_plugin_active('plugin-directory/plugin-file.php') ) {
// the plugin is active
}
@shaunpalmer
shaunpalmer / frontendDevlopmentBookmarks.md
Created September 15, 2024 03:37 — forked from PEKTOP/frontendDevlopmentBookmarks.md
A badass list of frontend development resources I collected over time.
@shaunpalmer
shaunpalmer / class.php
Created September 15, 2024 05:54 — forked from hlashbrooke/class.php
A complete, versatile options page class for any WordPress plugin
<?php
if ( ! defined( 'ABSPATH' ) ) exit;
class WordPress_Plugin_Template_Settings {
private $dir;
private $file;
private $assets_dir;
private $assets_url;
private $settings_base;
@shaunpalmer
shaunpalmer / a-cpt.php
Created September 15, 2024 06:51 — forked from neilgee/a-cpt.php
CPT (Custom Post Type) - WordPress Plugin - there are 2 snippets here - the one name - cpt-hide.php hides the single and archive views, the other one is normal
<?php
/*
Plugin Name: Testimonials Custom Post Type
Plugin URI: http://wpbeaches.com/create-custom-post-types-in-genesis-child-theme-in-wordpress/
Description: Testimonials Custom Post Types
Author: Neil Gowran
Version:1.0.0
Author URI:http://wpbeaches.com
*/
@shaunpalmer
shaunpalmer / plugin-settings.php
Created September 15, 2024 06:57 — forked from annalinneajohansson/plugin-settings.php
A base for a WordPress plugin settings page, using the Settings API #add_options_page #add_action #admin_init #register_setting #add_settings_section
<?php
# http://kovshenin.com/2012/the-wordpress-settings-api/
# http://codex.wordpress.org/Settings_API
add_action( 'admin_menu', 'my_admin_menu' );
function my_admin_menu() {
add_options_page( __('My Plugin Options', 'textdomain' ), __('My Plugin Options', 'textdomain' ), 'manage_options', 'my-plugin', 'my_options_page' );
}
add_action( 'admin_init', 'my_admin_init' );
@shaunpalmer
shaunpalmer / wp-config.php
Created September 15, 2024 06:59 — forked from danielmcclure/wp-config.php
Run WordPress Updates, WordPress Plugin Updates, and WordPress Theme Updates Automatically
<?php
/*
* Select one or more of the options below to your wp-config.php file to have WordPress updates run automatically.
*/
// Apply Major WordPress Updates Automatically
define( 'WP_AUTO_UPDATE_CORE', true );
// Apply Minor WordPress Updates Automatically
<?php
/*
Plugin Name: Site Plugin
Description: Site-specific code with support for Gutenberg blocks
Author: Shaun Palmer
Author URI: https://yourwebsite.com/
*/
class SP_SitePlugin {
👸🏻: Let's break down your ideas based on the **"Register and add settings page"** file you shared and explore ways to incorporate licensing, custom post types, and toggles on the settings page.
### Key Points from the File:
1. **Settings Page Structure**:
- You have a clear framework to add settings, which includes registering options, adding fields, and sanitizing input.
- This is an excellent base for further expansion.
2. **What You Want**:
- **Licensing/Key Registration**: You want a licensing system where you can store and validate a key.
- **Custom Post Types**: A section to manage custom post types.