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
@kimcoleman
kimcoleman / elementor_compatibility_for_pmpro.php
Last active February 4, 2025 15:48
Ensure Paid Memberships Pro compatibility when using the Elementor Page Builder.
<?php
/**
* Ensure Paid Memberships Pro compatibility when using the Elementor Page Builder:
* https://wordpress.org/plugins/elementor/
*
* Your administrator-level account must have a Membership Level in order to edit all of the pages assigned
* under Memberships > Pages.
*
* You must also set a Custom Field on the Membership Checkout page with the key 'pmpro_default_level' and
* value of a level ID in order to properly edit your Membership Checkout page using Elementor.
@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.
@SJ-James
SJ-James / collapse_sections.php
Created March 14, 2018 01:14
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 / 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
@JiveDig
JiveDig / facetwp-pagination-genesis-markup.php
Last active September 24, 2021 18:54
Adjust FacetWP's pager html to match Genesis markup. This allows it to inherit the Genesis theme styles. Used with [facetwp pager="true"]
<?php
/**
* Style pagination to look like Genesis.
*
* @version 1.0.0
*
* @author Mike Hemberger @JiveDig
*
* @link https://gist.github.com/JiveDig/b9810ba4c322d7757993159ed9ccb61f
@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
@zehfernandes
zehfernandes / pliim-turnOff.scpt
Last active September 16, 2024 06:39
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
@glueckpress
glueckpress / wp_rocket__wp_get_attachment_image__lazyload.php
Last active January 6, 2020 08:18
[WordPress][WP Rocket] [deprecated] Wrapper function: Applies WP Rocket’s LazyLoad to wp_get_attachment_image()
<?php
/**
* Wrapper function: Applies WP Rocket’s LazyLoad to wp_get_attachment_image()
*
* @link https://developer.wordpress.org/reference/functions/wp_get_attachment_image/
* @link https://github.com/wp-media/wp-rocket/blob/v2.10.9/inc/front/lazyload.php#L24-L47
*
* @param int $attachment_id (Required) Image attachment ID.
* @param string|array $size (Optional) Image size. Accepts any
* valid image size, or an array of width
// = Max File Size =
// =================
define( 'AI1WM_MAX_FILE_SIZE', 536870912 * 8 );
@slushman
slushman / customizer-links.php
Last active October 9, 2024 00:34
How to link into the WordPress Customizer