Skip to content

Instantly share code, notes, and snippets.

@divienginesupport
divienginesupport / de-custom-loop-template.css
Created July 31, 2023 13:39
Divi custom coded Loop Layout Template - CSS
.grid-col,
.grid-col > div,
.grid-col > div > article {
height:100%;
margin-bottom: 0;;
}
.card {
width:100%; /* Ensure the card is 100% width of the column */
box-shadow: rgba(149, 157, 165, 0.2) 0px 8px 24px; /* Add a shadow to make it stand out */
border-radius:10px; /* Subtle rounding on the corners */
@divienginesupport
divienginesupport / de-custom-loop-template.php
Created July 31, 2023 13:38
Divi custom coded Loop Layout Template - PHP
<?php
if ( ! defined( 'ABSPATH' ) ) exit;
// get the post ID
$post_id = get_the_ID();
?>
<article id="<?php echo $post_id; ?>" <?php post_class( 'et_pb_post clearfix grid-item'); ?>>
<div class="card">
/**
* Adjust the value 2 and 2fr according to the column count you need
**/
@media (max-width: 767px) {
.default-style ul.products {
grid-template-columns: repeat(2,minmax(10px,2fr))!important;
}
}
@divienginesupport
divienginesupport / de-menu_CTA_button.css
Created April 19, 2023 09:45
Divi Snippet - Turn a menu link into a CTA button
/* Menu CTA (Call to Action) button style, just make sure you add the class to the menu link */
/* Target elements with class 'de-menu-cta' */
.de-menu-cta {
/* Set the background color of the CTA button */
background-color: #0fe5a8; /* Change button background color here */
/* Set the border radius of the CTA button (rounded corners) */
border-radius: 50px; /* Set this to 0px if you want a square CTA button */
-webkit-border-radius: 50px; /* For WebKit browsers (e.g., Safari) */
-moz-border-radius: 50px; /* For Mozilla browsers (e.g., Firefox) */
@divienginesupport
divienginesupport / de-mobile_blur_background.css
Created April 19, 2023 09:42
Divi Mobile Snippet - Blur the background when the Divi Engine style menu is open
/* Add a blur effect when the Hamburger Menu is open */
/* Target the element with ID 'page-container' when the parent element has class 'show-menu' */
.show-menu #page-container {
/* Apply a 10-pixel blur effect to the element */
-webkit-filter: blur(10px); /* For WebKit browsers (e.g., Safari) */
-moz-filter: blur(10px); /* For Mozilla browsers (e.g., Firefox) */
-o-filter: blur(10px); /* For Opera browsers */
-ms-filter: blur(10px); /* For Microsoft browsers (e.g., Internet Explorer) */
filter: blur(10px); /* Standard filter property for modern browsers */
@divienginesupport
divienginesupport / de-mobile_show_theme_builder_header.css
Created April 19, 2023 09:40
Divi Mobile Snippet - Show the Theme Builder global header also when mobile breakpoint is set to 5000px
/* Show Theme Builder header on all screens */
/* The following media query targets screens with a maximum width of 5000 pixels */
@media only screen and (max-width: 5000px) {
/* Ensure that the header (with class 'et-l--header') is visible */
body .et-l--header,
/* Ensure that the navigation (with ID 'et-navigation') is visible */
body #et-navigation {
display: block !important; /* Use '!important' to override other styles */
}
@divienginesupport
divienginesupport / de-icon_font_icon_styling.css
Created April 19, 2023 07:40
CSS to style Divi Font Icons that have the class .de-icon
/* Styling for the .de-icon class used in some of our WooCommerce snippets */
.de-icon {
/* Set the color of the icon */
color: #0fe5a8 !important;
/* Set the font family for the icon */
font-family: "ETmodules";
/* Prevent the icon from being read by screen readers */
speak: none;
@divienginesupport
divienginesupport / de-woocommerce_cart_amount_shortcode.php
Last active April 19, 2023 09:36
WooCommerce Snippet - Shortcode for displaying a cart icon with the total amount in the cart next to it
/**
* Shortcode for displaying a WooCommerce cart icon with the cart total.
* The cart icon is linked to the WooCommerce cart page.
* Shortcode tag: [divi_engine_cart_icon]
*
* Make sure to add this CSS also https://gist.github.com/divienginesupport/ea2d56f435c94ca7607c243b9c8d829e
*
*/
function divi_engine_cart_icon_shortcode() {
@divienginesupport
divienginesupport / de-woocommerce_login_shortcode.php
Last active April 19, 2023 09:36
WooCommerce Snippet - Shortcode for My Account text if user is logged in, or Login/Register if not
/**
* Shortcode function for generating a link to the "My Account" page if the user is logged in,
* or to the "Register/Login" page if the user is not logged in.
*
* You can pass it a code from the Divi Icon Font for the icon to use
* -> https://www.elegantthemes.com/blog/resources/elegant-icon-font
*
* Shortcode tag: [de_login_register_link icon="e08a"]
*
* Make sure to add this CSS also https://gist.github.com/divienginesupport/ea2d56f435c94ca7607c243b9c8d829e
// This filter will work for contact from conditional recipients. The custom_contact_recipient is the function name.
add_filter('df_contact_recipient', 'custom_contact_recipient', 10, 3);
// Use this filter will work for my create post form type. The custom_form_recipient is the function name
add_filter('df_notification_recipient', 'custom_form_recipient', 10, 3);
// This is the function for the contact form
function custom_contact_recipient( $mail_to, $form_id, $form_data ) {
/*** Your conditions go here ***/