Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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 / 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 / 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 / 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 / gist:7ccb956346e924ca8d03819f75d8ea9d
Created July 26, 2022 22:24
List wp /upload directory file sizes.
$upload_dir = wp_upload_dir();
$folder = $upload_dir['basedir'];
$files = list_files( $folder );
foreach ( $files as $file ) {
if ( is_file( $file ) ) {
$filesize = size_format( filesize( $file ) );
$filename = basename( $file );
echo esc_html( $filename . " - (" . $filesize ) . ")<br />";
}
/**
* Snippet Action: Return Child Site Posts.
* Snippet Type: Return info from Child Sites.
*/
$posts = get_posts( array(
'post_type' => get_post_types(),
'post_status' => 'publish',
'numberposts' => -1,
) );
@kwcjr
kwcjr / Trigger-Elementor-DB-Update.snippet
Last active February 17, 2023 14:37
Trigger Elementor DB Update
<?php
/**
* Snippet Action: Trigger Elementor DB Update.
* Snippet Type: Return info from Child Sites. ( IMPORTANT! This will make it run one time )
* Snippet Author: Keith Crain ( Kronoslabs.io )
*/
add_action( 'plugins_loaded', 'klbs2345_trigger_elementor_db_update' );
function klbs2345_trigger_elementor_db_update() {
@kwcjr
kwcjr / css.snippet
Created November 5, 2022 16:08
Change MainWP Logo
/**
* 1.) Upload your logo to WP Media Library
* 2.) Copy the URL from Media Library
* 3.) Paste on line 13
*/
/* Hide Original logo */
.mainwp-nav-wrap #mainwp-logo img {
display: none!important;
}