Skip to content

Instantly share code, notes, and snippets.

@noellesteegs
noellesteegs / sale-badge-text.php
Last active Aug 23, 2019
Change text of WooCommerce sale badge
View sale-badge-text.php
add_filter( 'woocommerce_sale_flash', 'edit_sale_badge_text' );
function edit_sale_badge_text() {
return '<span class="onsale">Buy me!</span>';
}
@noellesteegs
noellesteegs / content-below-product-price.php
Created Aug 26, 2019
Add content below price @ WooCommerce single product
View content-below-product-price.php
add_action( 'woocommerce_single_product_summary', 'content_below_price', 15 );
function content_below_price() {
echo 'TEST';
}
@noellesteegs
noellesteegs / storefront-footer-text.php
Last active Aug 26, 2019
Add test text @ Storefront footer
View storefront-footer-text.php
@noellesteegs
noellesteegs / single-product-category-notice.php
Last active Aug 26, 2019
Add text above cart form @ WooCommerce single product if in particular category
View single-product-category-notice.php
add_action( 'woocommerce_before_add_to_cart_form', 'category_notice' );
function category_notice() {
if (has_term('accessories', 'product_cat')) { // Replace 'accessories' with your category
echo '<div class="category_notice"><p>This is a notice.</p></div>';
}
}
@noellesteegs
noellesteegs / styled-checkboxes.css
Created Sep 13, 2019
Replace default HTML checkboxes with Font Awesome icons
View styled-checkboxes.css
input, input::before {
margin: 0px !important;
top: 0px;
}
label {
cursor: pointer;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
@noellesteegs
noellesteegs / 12-point-star.css
Created Dec 10, 2019
Style WooCommerce price on single product pages into a star burst shape
View 12-point-star.css
body.single-product p.price {
color: #FFFFFF;
line-height: 80px; /* vertically aligns the price within the star */
font-size: 1.375rem;
}
#burst-12 {
background: #FA7268;
width: 80px;
height: 80px;
text-align: center;
@noellesteegs
noellesteegs / remove-img-p-tags.php
Created Apr 10, 2020
Remove auto p tags around images
View remove-img-p-tags.php
function filter_ptags_on_images($content){
return preg_replace('/<p>\s*(<a .*>)?\s*(<img .* \/>)\s*(<\/a>)?\s*<\/p>/iU', '\1\2\3', $content);
}
add_filter('the_content', 'filter_ptags_on_images');
/* Originally posted @ https://css-tricks.com/snippets/wordpress/remove-paragraph-tags-from-around-images/ */
@noellesteegs
noellesteegs / cf7-radio-check.css
Created Apr 21, 2020
Replace Contact Form 7's checkboxes and radio buttons with Divi's icon font
View cf7-radio-check.css
.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;
@noellesteegs
noellesteegs / wc-cart-button-text.php
Created Aug 3, 2020
Edit WooCommerce add to cart button text
View wc-cart-button-text.php
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 / wc-skip-cart.php
Created Aug 3, 2020
Skip cart and go straight to checkout when clicking add to cart button in WooCommerce
View wc-skip-cart.php
add_filter('woocommerce_add_to_cart_redirect', 'skip_cart');
function skip_cart() {
global $woocommerce;
$checkout_url = wc_get_checkout_url();
return $checkout_url;
}
You can’t perform that action at this time.