Skip to content

Instantly share code, notes, and snippets.

View robertstaddon's full-sized avatar

Robert Staddon robertstaddon

View GitHub Profile
@robertstaddon
robertstaddon / style.css
Created August 14, 2017 21:19
Divi - style the custom featured image (include default blog page)
@media all and (min-width: 768px) {
.et_pb_posts img, .archive .post img, .category .post img, .search .post img, .blog .post img {
float: left;
margin-right: 1em;
}
.et_pb_posts article:after, .archive article:after, .category article:after, .search article:after, .blog article:after { /* Clear floated image */
content: "";
display: table;
clear: both;
}
@robertstaddon
robertstaddon / style.css
Created August 17, 2017 07:22
Divi - CSS rule for an overlay
.background-fade .et_pb_slide:after {
position: absolute;
content: '';
top: 0;
right: 0;
left: 0;
bottom: 0;
background-color:rgba(0,0,0,.5);
}
@robertstaddon
robertstaddon / style.css
Created August 17, 2017 07:23
Divi - CSS rule for an overlay (with light overlay)
.background-fade .et_pb_slide.et_pb_bg_layout_light:after {
position: absolute;
content: '';
top: 0;
right: 0;
left: 0;
bottom: 0;
background-color:rgba(255,255,255,.7);
}
@robertstaddon
robertstaddon / style.css
Created August 17, 2017 07:25
Divi - CSS rule for an overlay (with animation)
.background-fade .et_pb_slide.et_pb_bg_layout_dark:after {
position: absolute;
content: '';
top: 0;
right: 0;
left: 0;
bottom: 0;
animation: customFadeToDark 3s ease-out 1s 1 both;
-webkit-animation: customFadeToDark 3s ease-out 1s 1 both;
}
@robertstaddon
robertstaddon / functions.php
Last active June 14, 2023 18:17
Divi - remove Divi sidebar from all WooCommerce Product pages (as well as Shop and Category pages) pages with a hook
<?php
/**
* Remove Divi sidebar from all WooCommerce Product pages (as well as Shop and Category pages)
*/
function mytheme_divi_output_content_wrapper_end() {
echo '
</div> <!-- #left-area -->
</div> <!-- #content-area -->
</div> <!-- .container -->
@robertstaddon
robertstaddon / functions.php
Last active August 20, 2020 17:55
Divi - remove Divi sidebar from all WooCommerce Product pages with a hook
<?php
/**
* Remove Divi sidebar from all WooCommerce Product pages
*/
function mytheme_divi_output_content_wrapper_end() {
echo '
</div> <!-- #left-area -->
</div> <!-- #content-area -->
</div> <!-- .container -->
</div> <!-- #main-content -->';
@robertstaddon
robertstaddon / myClassExcerpt.php
Created September 10, 2019 00:57
Fix Gravity PDF form submission delay when PDF is attached to notifications by using Gravity Forms Delayed Email Notifications
public function __construct() {
// Stop any PDFs from being immediately generated (require Gravity Forms Delayed Email Notifications)
add_filter( 'gfpdf_maybe_attach_to_notification', array( $this, 'require_delayed_notifications' ), 10, 5 );
}
public function require_delayed_notifications( $attach, $notification, $settings, $entry, $form ) {
// Disable Gravity PDF attachment if the notification has a flag (__AFTER_DELAY_FLAG__) letting us know that this notification is supposed to wait until after the delay
if ( preg_match( '/__AFTER_DELAY_FLAG__/', $notification['subject'] ) ) {
return false;
@robertstaddon
robertstaddon / functions.php
Created January 8, 2020 00:51
LiteSpeed - register WordPress menu as ESI block
<?php
add_action( 'init', function() {
if ( method_exists( 'LiteSpeed_Cache_API', 'esi_enabled' ) && LiteSpeed_Cache_API::esi_enabled() ) {
LiteSpeed_Cache_API::hook_tpl_not_esi( function () {
add_filter( 'wp_nav_menu', function( $nav_menu_html, $args ) {
if ( $args->menu_id == "menu-id-to-replace" ) {
return LiteSpeed_Cache_API::esi_url( 'my_custom_menu_esi_hook', 'My Menu to Use with ESI' );
}
return $nav_menu_html;
@robertstaddon
robertstaddon / lscwp-3rd-user-switching.cls.php
Last active January 8, 2020 15:20
Register User Switching plugin switch back URL nonce as a Third Party integration with LiteSpeed Cache
<?php
/**
* The Third Party integration with User Switching plugin.
*
* @since 2.9.9.2
* @package LiteSpeed_Cache
* @subpackage LiteSpeed_Cache/thirdparty
* @author LiteSpeed Technologies <info@litespeedtech.com>
*/
if ( ! defined( 'ABSPATH' ) ) {
@robertstaddon
robertstaddon / functions.php
Created April 20, 2020 18:59
Fix YITH My Account Divi Color Picker Compatibility
<?php
add_action('admin_head', 'yith_divi_color_picker_compatibility');
function yith_divi_color_picker_compatibility() {
echo '
<style>
.yith-plugin-ui .wp-picker-container a.wp-color-result {
width: 30px;
height: 30px;
box-shadow: none;