Skip to content

Instantly share code, notes, and snippets.

@divienginesupport
divienginesupport / de-slick.js
Last active May 24, 2021 12:05
Slick.js Divi Initialization Code
jQuery(function($){
$('.slide-stuff').slick({ // Define the class which will be used to designate the parent container for the Divi Modules that will make up our slides
infinite: true, // This sets our slider to slide infinitely in a loop
slidesToShow: 3, // How many slides should be visible at all times
slidesToScroll: 1 // How many slides should scroll
});
});
@divienginesupport
divienginesupport / MIME-types_functions.php
Last active June 11, 2021 11:11
Allow Specific MIME-types in WordPress with the functions.php file
// Copy and paste this block of code to the functions.php file of your child theme
function divi_engine_custom_mime_types( $mimes ) {
// Add your additional allowed mime types here from the list above.
$mimes['csv'] = 'text/csv'; //copy or modify this line to add different mime types
// Optionally, you can also remove MIME-types.
unset( $mimes['exe'] );
@divienginesupport
divienginesupport / MIME-types_wp-config.php
Created June 10, 2021 19:58
Allow All MIME-types in WordPress with the wp-config.php file
/* Add this code above the "That’s all, stop editing. Happy blogging." comment */
define('ALLOW_UNFILTERED_UPLOADS', true);
@divienginesupport
divienginesupport / DE_CSS_animation_focus_in.css
Last active June 21, 2021 18:39
Divi Pure CSS Animation - Focus In
/* Focus-in CSS Animation Class to be added to the Divi module that you want to animate */
.de-focus-in {
-webkit-animation: de-focus-in 1s cubic-bezier(0.250, 0.460, 0.450, 0.940) both;
animation: de-focus-in 1s cubic-bezier(0.250, 0.460, 0.450, 0.940) both;
}
/* Focus-in CSS Animation Keyframes */
@-webkit-keyframes de-focus-in {
@divienginesupport
divienginesupport / DE_CSS_animation_pop_up.css
Last active June 21, 2021 20:33
Divi Pure CSS Animation - Focus In
/* Pop-up CSS Animation Class to be added to the Divi module that you want to animate */
.de-text-pop-up {
-webkit-animation: de-text-pop-up 0.5s cubic-bezier(0.250, 0.460, 0.450, 0.940) both;
animation: de-text-pop-up 0.5s cubic-bezier(0.250, 0.460, 0.450, 0.940) both;
}
/* Keyframes for the Pop-up CSS Animation */
@-webkit-keyframes de-text-pop-up {
@divienginesupport
divienginesupport / DE_CSS_animation_wobble.css
Last active June 22, 2021 06:02
Divi Pure CSS Animation - Wobble
/* Wiggle CSS Animation Class to be added to the Divi module that you want to animate */
.de-wobble {
-webkit-animation: de-wobble 2.8s both infinite;
animation: de-wobble 2.8s both infinite;
text-align: center;
}
/* Keyframes for the wobble animation */
@divienginesupport
divienginesupport / DE-Color-Change-Keyframes.css
Last active June 21, 2021 21:28
Divi Engine CSS Keyframes Example
.de-colorchange {
animation: colorchange 4s infinite;
}
@keyframes colorchange {
0% {background-color: red;}
25% {background-color: green;}
75% {background-color: blue;}
100% {background-color: yellow;}
}
@divienginesupport
divienginesupport / divi-custom-breakpoints.css
Created July 27, 2021 09:22
Custom Divi Breakpoints for Devices
/*** Responsive Styles Extra Large Desktop And Above ***/
@media all and (min-width: 1405px) {
YOUR CSS HERE
}
/*** Responsive Styles Standard Desktop Only ***/
@media all and (min-width: 1100px) and (max-width: 1405px) {
@divienginesupport
divienginesupport / custom-breakpoint-example.css
Last active July 27, 2021 13:37
Custom Breakpoints Example CSS
.de-breakpoint:after {
Content: "Extra Large Desktop";
}
@divienginesupport
divienginesupport / auto_add_coupon.php
Created August 30, 2021 19:00
Automatically add a coupon code on the checkout page
/**
* Apply Coupon Code automatically to the cart
*/
function divi_engine_apply_discount_to_cart() {
$order_total = WC()->cart->get_subtotal();
if( $order_total > 50 ) { //Here you set the condition which in this case is spend over $50
$coupon_code = '20%OFF'; //Here you indicate which coupon code to apply
if ( !WC()->cart->add_discount( sanitize_text_field( $coupon_code ) ) ) {