Skip to content

Instantly share code, notes, and snippets.

@noellesteegs
noellesteegs / remove-img-p-tags.php
Created April 10, 2020 12:30
Remove auto p tags around images
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 / 12-point-star.css
Created December 10, 2019 09:33
Style WooCommerce price on single product pages into a star burst shape
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 / styled-checkboxes.css
Created September 13, 2019 09:15
Replace default HTML checkboxes with Font Awesome icons
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 / content-below-product-price.php
Created August 26, 2019 12:32
Add content below price @ WooCommerce single product
add_action( 'woocommerce_single_product_summary', 'content_below_price', 15 );
function content_below_price() {
echo 'TEST';
}
@noellesteegs
noellesteegs / single-product-category-notice.php
Last active August 26, 2019 12:34
Add text above cart form @ WooCommerce single product if in particular category
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 / sale-badge-text.php
Last active August 23, 2019 12:52
Change text of WooCommerce sale badge
add_filter( 'woocommerce_sale_flash', 'edit_sale_badge_text' );
function edit_sale_badge_text() {
return '<span class="onsale">Buy me!</span>';
}
@noellesteegs
noellesteegs / storefront-footer-text.php
Last active August 26, 2019 12:33
Add test text @ Storefront footer