Skip to content

Instantly share code, notes, and snippets.

@kwcjr
kwcjr / domain-status.php
Created July 16, 2022 16:44
Domain Status Report snippet
<?php if ( $plugin_active_domainmonitor ) { ?>
<tr><th><?php echo __( 'Domain status', 'mainwp-pro-reports-extension' ); ?></th><td>[domain.monitor.status]</td></tr>
<?php } ?>
@kwcjr
kwcjr / svg.css
Created April 15, 2022 04:04
SVG Icon
#adminmenu #toplevel_page_ContactSupport2 .dashicons-admin-generic::before{
content: ' ';
background-repeat: no-repeat;
background-image: url(data:image/svg+xml;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAAEHSURBVDhPpZPPCgFRFIe/mUhYUFJi5xW8gvIOFmJrR7OyUrKw8wJsvYPyJhY2kp2Fv0XHZU5Jrkt8dZvfmXPna+69M57s90K3C5EIFArQbOJkPIb5HC4X6HRAej0Rc7mPYlE+Uio95geB+MTjqjYkkxocJBIaDOZZX+NveN6fAoNbMJ3CbKaFHbegUoFyWQs7dkG/f18f6XR4tLfcamnzGbug0YBoFDYbWC4hFoMg0OYzdkE+D6sVjEYwHMJ6Hb6Jhfd7kMlArQbVKqRSevMV9ybePu9sVgs7bsEX/Ccwf4TP8aiVYbvV4GC302A4HPDkdBIGg/DYcjmo17X7hskEFgs4n6Hd5goYOmhHCaP71QAAAABJRU5ErkJggg==);
}
@kwcjr
kwcjr / functions.php
Last active March 2, 2022 23:36
Add custom preview text to wp_mail
<?php
/**
* Plugin Name: Replace Pre-Header Email Text.
* Description: Replace Line 27 with what text you want. This will replace the text just after your Subject - "Your text".
* Author: Keith Crain ( Kronoslabs.io )
* License: GNU General Public License v3 or later
* License URI: http://www.gnu.org/licenses/gpl-3.0.html
*/
/**
@kwcjr
kwcjr / klbs_custom_woo_pre_header_text.php
Last active March 2, 2022 23:37
Replace WooCommerce Subject line Preview Text ( drop in /wp-content/mu-plugins/ folder.
<?php
/**
* Plugin Name: Replace Pre-Header Email Text.
* Description: Replace Line 27 with what text you want. This will replace the text just after your Subject - "Your text".
* Author: Keith Crain ( Kronoslabs.io )
* License: GNU General Public License v3 or later
* License URI: http://www.gnu.org/licenses/gpl-3.0.html
*/
/**
@kwcjr
kwcjr / add_to_cart.php
Last active February 12, 2022 04:19
Change add to cart text
// To change add to cart text on single product page.
add_filter( 'woocommerce_product_single_add_to_cart_text', 'custom_add_to_cart_callback' );
// To change add to cart text on product archives(Collection) page.
add_filter( 'woocommerce_product_add_to_cart_text', 'custom_add_to_cart_callback' );
// Custom add_to_cart text to change to.
function custom_add_to_cart_callback() {
return __( 'Submit Payment', 'text-domain' );
}
@kwcjr
kwcjr / divi_popup.php
Last active January 29, 2022 11:32
Load custom Divi popup scripts.
/**
* Load custom Divi popup scripts.
* @source https://divihacks.com/how-to-create-a-popup-in-divi-without-a-plugin/
*/
function uniqueID_content_after_body_open_tag() {
?>
<script type="text/javascript">jQuery(document).ready(function(t){t('div:not(.et_mobile_menu) .lightbox-content, div:not(.et_mobile_menu) [class*="lightbox-content-"]').addClass("mfp-hide"),t("div:not(.et_mobile_menu) .lightbox-trigger").magnificPopup({items:{src:"div:not(.et_mobile_menu) .lightbox-content",type:"inline"}}),t('div:not(.et_mobile_menu) [class*="lightbox-trigger-"]').each(function(){var i=".lightbox-content-"+Array.prototype.find.call(this.classList,function(t){return t.indexOf("lightbox-trigger-")>-1}).split("lightbox-trigger-")[1];t(this).magnificPopup({items:{src:i,type:"inline"}})}),t(this).click(function(){t(".mfp-wrap").attr("id","et-boc")}),t('[class*="lightbox-content"]').prepend('<div class="lightbox-overlay"></div>')});</script>
<script src="/wp-content/themes/Divi/includes/builder/feature/d
@kwcjr
kwcjr / mainwp-pro-report-template.php
Created January 16, 2022 22:46
MainWP Pro Reports WordFence Table.
<!-- WordFence Data -->
<div class="page-break"></div>
<div style="padding:30px;">
<div style="padding:30px;">
<h2><?php echo __( 'WordFence', 'mainwp-pro-reports-extension' ); ?></h2>
<h3><?php echo __( 'Total Scan Count: ', 'mainwp-pro-reports-extension' ); ?>[wordfence.scan.count]</h3>
<table>
<thead>
<tr>
<th><?php echo __( 'Scanned on', 'mainwp-pro-reports-extension' ); ?></th>
@kwcjr
kwcjr / delete-wp-readme.php
Created November 27, 2021 00:53
Delete WP readme.html
/**
* Delete WP readme.html file remotely.
*
* This snippet will delete the readme.html file from your Child Site root dir.
*
* @snippetType: Return info from Child Site.
*/
// Load in WP Core files we need.
include_once(ABSPATH . WPINC . '/functions.php');
include_once(ABSPATH . WPINC . '/plugins.php');
@kwcjr
kwcjr / purge-ls-after-updates.php
Created November 25, 2021 11:47
Purge LiteSpeed cache after updates.
/**
* Purge LiteSpeed Cache after updates.
*
* This snippet will check if LS plugin is activated & then Purge all Cache
* after any Core, Theme or Plugin Installation, Update or rollback.
*
* @snippetType: Execute on Child Sites
*/
function my_upgrade_function( $upgrader_object, $options ) {
// Purge all LS Cache.
@kwcjr
kwcjr / after_wp_updates.php
Last active December 8, 2021 16:47
After WP Plugin update Hook
/**
* Purge LiteSpeed Cache after updates.
*
* This snippet will check if LS plugin is activated & then Purge all Cache
* after any Core, Theme or Plugin Installation, Update or rollback. Then it
* will email the results to the given address on line 35. Disable by commenting out
* line 39.
*
* @howto: Update line 35 with your email address and save the code snippet to Execute on Child Sites.
*