Skip to content

Instantly share code, notes, and snippets.

View mikeott's full-sized avatar
😀
Greetings programs. See you on the grid.

Michael Ott mikeott

😀
Greetings programs. See you on the grid.
View GitHub Profile
@mikeott
mikeott / check-for-plugin-update.php
Created January 13, 2025 02:22
check-for-plugin-update
/* Check for updates */
function my_custom_update_checker() {
$allowed_pages = array(
'update-core',
'plugins',
'plugin-install',
'network/update-core',
'network/plugins',
'network/plugin-install',
'update'
@mikeott
mikeott / Electron
Last active October 23, 2024 05:10
Electron
// Run electron app
npm run electron
// Reload maim window without having to quit and restart electron.
npx electronmon .
// Install toast module (if you want toast notifications in the app)
npm i electron toastify-js
// Install Xel UI kit
@mikeott
mikeott / WPCLI Commands.txt
Last active October 20, 2024 08:25
WPCLI Commands
ssh [email protected]
wp core check-update
wp core update
wp plugin list
wp plugin update --all
@mikeott
mikeott / WordPress plugin Sanitise and Validate settinhgs fields.php
Created January 2, 2024 00:37
WordPress plugin Sanitise and Validate settinhgs fields
<?php
// In the main plugin file:
/* Register settings */
function my_cool_plugin_settings_init() {
register_setting (
'my_cool_plugin_settings',
'my_cool_plugin_settings',
'my_cool_plugin_settings_validate'
@mikeott
mikeott / WooCommerce Add something to my account page.php
Last active November 13, 2023 05:11
WooCommerce: Add something to my account page
add_action( 'woocommerce_account_content', 'action_woocommerce_account_content' );
function action_woocommerce_account_content( ) {
// Do something
};
@mikeott
mikeott / WordPress Enqueue jQuery.php
Created October 27, 2023 14:03
WordPress Enqueue jQuery
/* If jQuery is not enqueued, do it */
function enqueue_jquery() {
wp_enqueue_script('jquery');
}
add_action('wp_enqueue_scripts', 'enqueue_jquery');
@mikeott
mikeott / Rocket Apps disable email reminders
Last active October 12, 2023 11:47
Rocket Apps: DIsable email reminders
<?php //Custom user profile checkbox:
/* Add custom user profile field */
function custom_user_profile_fields($user) {
?>
<h3>Custom User Fields</h3>
<table class="form-table">
<tr>
<th>
@mikeott
mikeott / Product names for use in Gravity Forms field.php
Last active October 11, 2023 07:20
Gravity Forms Product names for use in field
<?php /* Product names for use in Gravity Forms field */
function ra_all_product_names() {
$args = array(
'post_type' => 'product',
'orderby' => 'title',
'order' => 'asc',
'posts_per_page' => -1
);
$gchoice_count = 1;
$input_count = 1;
@mikeott
mikeott / gravity-forms-submenu-item.php
Last active September 25, 2023 01:48
Gravity Forms sub menu item
/* Add 'Entry Reports' to Gravity Forms 'Settings' form page */
add_filter( 'gform_form_settings_menu', 'gfer_form_settings_menu_item' );
function gfer_form_settings_menu_item( $menu_items ) {
$menu_items[] = array(
'name' => 'gfer_form_settings_page',
'label' => __('Entry Reports', 'gravity-forms-entry-reports'),
'title' => __('Entry Reports', 'gravity-forms-entry-reports'),
'menu_class' => 'gfer_settings_navigation',
@mikeott
mikeott / WordPress add paramater to function for CPT.php
Last active September 18, 2023 05:48
WordPress add paramater to function for CPT
<?php
/*
Funds list
Usage:
funds_list(false); // Include the images
or
funds_list(); // DOon't include the images
*/
function funds_list($output_images = true) {