Skip to content

Instantly share code, notes, and snippets.

View deckerweb's full-sized avatar
🏠
Working from home

David Decker deckerweb

🏠
Working from home
View GitHub Profile
@deckerweb
deckerweb / collapse_sections.php
Created March 14, 2018 14:31 — forked from SJ-James/collapse_sections.php
Add a 'Collapse Section' button to the Elementor Editor
<?php
//Add to functions.php in child theme
function e_collapse_sections(){
?>
<!-- Scripts and styles should enqueued properly but for the sake of having it all in one function...-->
<script>
if ( self !== top ) { // Check if we're in a preview window / iframe
jQuery(document).ready(function($){
@deckerweb
deckerweb / polylang-switch-to-english-locale.php
Created March 14, 2018 10:42
Polylang plugin - switch to English locale -- below Code Snippet should go into "Code Snippets" plugin at best (please avoid functions.php or similar hacks)!
<?php
/** Do NOT include the opening php tag */
add_action( 'admin_init', 'ddw_polylang_switch_to_english_locale', 100 );
/**
* Load default English (en_US) locale when using Polylang (and, for example,
* with Elementor Page Builder) and are in an Non-English context, like
* editing a page in Swedisch, German, or whatever.
* NOTE: Change the instances of 'en_US' to the locale you want.
// = Max File Size =
// =================
define( 'AI1WM_MAX_FILE_SIZE', 536870912 * 8 );
@deckerweb
deckerweb / customizer-links.php
Created March 12, 2018 19:30 — forked from slushman/customizer-links.php
How to link into the WordPress Customizer
@deckerweb
deckerweb / astra-remove-metaboxes-for-nonadmins.php
Last active June 10, 2021 06:07
Remove Meta Boxes on Post & Page Edit Screens from "Astra" Theme and "Astra Pro" Plugin for users who are not Administrators, so Editors and below. Inspired by user question: https://www.facebook.com/groups/wpastra/permalink/367143130421624/ -- below Code Snippet should go into "Code Snippets" plugin at best (please avoid functions.php)!
<?php
/** Do NOT include the opening php tag */
add_action( 'do_meta_boxes', 'ddw_remove_astra_metaboxes_for_non_admins' );
/**
* Remove Astra settings meta box for users that are not administrators
* Inspired by: https://www.facebook.com/groups/wpastra/permalink/367143130421624/?comment_id=367167440419193&comment_tracking=%7B%22tn%22%3A%22R1%22%7D
*
* @author David Decker - DECKERWEB
@deckerweb
deckerweb / unload-elementor-textdomain.php
Last active August 1, 2021 15:04
Unload Elementor Textdomain -- below Code Snippet should go into "Code Snippets" plugin at best (please avoid functions.php or similar hacks)!
<?php
/** Do NOT include the opening php tag */
add_action( 'plugins_loaded', 'ddw_unload_elementor_textdomain' );
/**
* Unload Textdomain for "Elementor" and "Elementor Pro" plugins.
* (Comment functions out for those not wanted to unload.)
*
* @author David Decker - DECKERWEB
@deckerweb
deckerweb / plugin-settings.php
Created March 3, 2018 13:55 — 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' );
@deckerweb
deckerweb / pliim-turnOff.scpt
Created January 10, 2018 08:58 — forked from zehfernandes/pliim-turnOff.scpt
One click and be ready to go up on stage and shine! - https://zehfernandes.github.io/pliim/
# Turn on Notifications
do shell script "defaults -currentHost write com.apple.notificationcenterui doNotDisturb -bool FALSE; defaults -currentHost delete com.apple.notificationcenterui doNotDisturbDate; osascript -e 'quit application \"NotificationCenter\" ' && killall usernoted" -- this set 'Do not disturb' to false in the pref
# Show Desktop
do shell script "defaults write com.apple.finder CreateDesktop -bool true; killall Finder"
# Show all windows
tell application "System Events"
set visible of (every process) to true
end tell
@deckerweb
deckerweb / use-email-for-login-woocommerce.php
Created January 10, 2018 08:14 — forked from JustinSainton/use-email-for-login-woocommerce.php
Use the submitted email address for the username in WooCommerce registration.
<?php
add_filter( 'woocommerce_new_customer_data', function( $data ) {
$data['user_login'] = $data['user_email'];
return $data;
} );
@deckerweb
deckerweb / functions.php
Created April 17, 2017 19:39 — forked from ChrisCree/functions.php
Add the Shop page breadcrumb to single products and archives for WooCommerce pages with the Genesis framework. Code below can be added to your child theme's functions.php file. Then go to Genesis --> Theme Settings and ensure the Breadcrumbs settings for Posts and Archives is enabled. PLEASE NOTE: This code assumes the Genesis Connect for WooCom…
<?php
// Do not copy opening PHP tag above
// Add the Shop page to Genesis breadcrumbs in WooCommerce
// NOTE: Assumes Genesis Connect for WooCommerce plugin is active
add_filter( 'genesis_archive_crumb', 'wsm_prepend_shop_link', 11, 2 );
add_filter( 'genesis_single_crumb', 'wsm_prepend_shop_link', 11, 2 );
function wsm_prepend_shop_link( $crumb, $args ) {
if ( is_singular( 'product' ) || is_tax( 'product_cat' ) || is_tax( 'product_tag' ) ) {