Skip to content

Instantly share code, notes, and snippets.

@noellesteegs
noellesteegs / mobile_menu_toggle.css
Last active March 25, 2024 10:08
Add toggles to Divi's mobile menu
@media (max-width: 980px) {
.et_mobile_menu {
overflow: hidden;
}
.et_mobile_menu li.menu-item-has-children {
position: relative;
}
.et_mobile_menu li.menu-item a {
background-color: #fff;
font-weight: 400;
@noellesteegs
noellesteegs / wc-cross-sells-heading.php
Created November 8, 2023 09:39
Change WooCommerce cross-sells heading text on the cart page
add_filter( 'woocommerce_product_cross_sells_products_heading', 'na_change_cross_sells_products_heading' );
function na_change_cross_sells_products_heading() {
return 'You will definitely like';
}
@noellesteegs
noellesteegs / tec_view_meta_desc.php
Last active September 15, 2023 10:48
Sets meta descriptions for The Events Calendar views through Yoast SEO
<?php
function na_filter_events_desc( $description ) {
if( tribe_context()->get( 'view_request' ) === 'default' ) {
$description = 'Your description here.';
} elseif( tribe_context()->get( 'view_request' ) === 'list' ) {
$description = 'Your description here.';
} elseif( tribe_context()->get( 'view_request' ) === 'day' ) {
$description = 'Your description here.';
} elseif( tribe_context()->get( 'view_request' ) === 'map' ) {
@noellesteegs
noellesteegs / free_shipping_notice.php
Last active September 12, 2023 12:13
"You're only x away from free shipping" notice
function na_woo_free_shipping_notice() {
if ( is_plugin_active( 'woocommerce/woocommerce.php' ) ) { // Check whether Woo is active
$location = WC_Geolocation::geolocate_ip(); // Get location data via MaxMind Geolocation
$country = $location['country']; // Get the country from MaxMind data
switch ( $country ) { // Check what the country is
case "BE": // If it's Belgium...
$min_amount = 100; /// ...then apply this amount...
break;
case "DE": // ...etc.
$min_amount = 150;
@noellesteegs
noellesteegs / conditional_divi_logo.php
Last active July 5, 2021 13:18
Conditionally display a different logo based on page ID in Divi theme
// Create the function and pass the variable
function my_conditional_logo( $logo_container ) {
// Create a conditional statement to target specific page IDs
if( is_page( array( 1, 5, 9 ) {
// Create variable and set it to the path of the logo you'd like to display on these specific pages
$logo_url = '/wp-content/uploads/2021/07/my_logo_alt.svg';
// If the conditional statement is false, use the default
<?php
// Determines what to do - creates the function with your function name
function add_note_to_product() {
// Checks whether the product is in the Hoodies product category
if ( has_term('hoodies', 'product_cat' ) ) {
// Gets the note field
$note = get_field( 'note' );
@noellesteegs
noellesteegs / disable-add-to-cart-message.php
Created August 3, 2020 13:08
Disable add to cart message in WooCommerce
add_filter( 'wc_add_to_cart_message_html', '__return_false' );
@noellesteegs
noellesteegs / wc-skip-cart.php
Created August 3, 2020 13:04
Skip cart and go straight to checkout when clicking add to cart button in WooCommerce
add_filter('woocommerce_add_to_cart_redirect', 'skip_cart');
function skip_cart() {
global $woocommerce;
$checkout_url = wc_get_checkout_url();
return $checkout_url;
}
@noellesteegs
noellesteegs / wc-cart-button-text.php
Created August 3, 2020 12:52
Edit WooCommerce add to cart button text
add_filter( 'woocommerce_product_add_to_cart_text', 'edit_add_to_cart_button_text' );
function edit_add_to_cart_button_text() {
return 'Buy now';
}
@noellesteegs
noellesteegs / cf7-radio-check.css
Created April 21, 2020 14:42
Replace Contact Form 7's checkboxes and radio buttons with Divi's icon font
.wpcf7-checkbox .wpcf7-list-item input[type=checkbox],
.wpcf7-radio .wpcf7-list-item input[type=radio] {
visibility: hidden;
margin: 0;
width: 0!important;
}
input[type=checkbox] + .wpcf7-list-item-label,
input[type=radio] + .wpcf7-list-item-label {
font-size: initial;
font-weight: initial;