Skip to content

Instantly share code, notes, and snippets.

@deeman
deeman / woo-html-term-description.php
Created March 13, 2022 14:45
WooCommerce - Allow HTML In Category Description
/**
* Allow HTML in term (category, tag) descriptions
*/
foreach ( array( 'pre_term_description' ) as $filter ) {
remove_filter( $filter, 'wp_filter_kses' );
if ( ! current_user_can( 'unfiltered_html' ) ) {
add_filter( $filter, 'wp_filter_post_kses' );
}
}
@deeman
deeman / wc-noindex-nofollow.php
Last active March 9, 2022 12:17
(SEO) WooCommerce "No Index, No Follow" on cart, order, checkout- pages then using YOAST!
function woo_seo_noindex_special_pages () {
global $post;
$woocommerce_pages = array('cart', 'checkout', 'order-received', 'order-tracking',
'my-account', 'logout', 'lost-password', 'mijireh-secure-checkout');
$slug = get_post($post)->post_name;
if (in_array($slug, $woocommerce_pages)) {
echo '<meta name="robots" content="noindex,follow"/>' . "\n";
}
@deeman
deeman / right.css
Created July 5, 2021 18:33
Genesis Header Right Widget CSS
/* Header Right Widget
------------------------------------------------*/
.header-widget-area .widget {
margin-bottom: 0 !important;
display: inline-block;
margin: 0;
padding: 0;
}
.header-widget-area {
float: right;
@deeman
deeman / functions.php
Created November 13, 2020 00:28
WooCommer - Add social share buttons under the short description
/**
* Add social share buttons under the short description
*/
function woo_social_share_under_desc() {
// Vars
$product_title = get_the_title();
$product_url = get_permalink();
$product_img = wp_get_attachment_url( get_post_thumbnail_id() ); ?>
@deeman
deeman / functions.php
Created August 15, 2020 12:07
Genesis Framework - Widget Areas Before Footer
// Step-1: Create Extra Widget Area
genesis_register_sidebar( array(
'id' => 'beforefooterarea',
'name' => __( 'Before_Footer_Area', 'child theme' ),
'description' => __( 'This is Before Footer Widget Headline...', 'child theme' ),
) );
// Step-2: Position Widget Header - Place widget before Widget area
@deeman
deeman / functions.php
Created August 15, 2020 12:04
Genesis Framework - Widget Area Before Content
// Registers Widget Area Before Content
genesis_register_sidebar( array(
'id' => 'widget-before-content',
'name' => __( 'Widget Before Content', 'genesis' ),
'description' => __( 'Displays Content Before All Single Posts.', 'genesis' ),
) );
//LOCATION
add_action( 'genesis_after_header', 'wv_widget_location_before_content' );
function wv_widget_location_before_content () {
genesis_widget_area( 'widget-before-content', array(
@deeman
deeman / functions.php
Created August 15, 2020 12:02
Genesis Framework - Top Bar Utility Bar
/*Top Bar Utility Bar, left & right*/
/** Register Utility Bar Widget Areas. */
genesis_register_sidebar( array(
'id' => 'utility-bar-left',
'name' => __( 'Utility Bar Left', 'theme-prefix' ),
'description' => __( 'This is the left utility bar above the header.', 'theme-prefix' ),
) );
genesis_register_sidebar( array(
'id' => 'utility-bar-right',
'name' => __( 'Utility Bar Right', 'theme-prefix' ),
@deeman
deeman / functions.php
Created July 25, 2020 11:49
WooCommerce: Remove Additional Notes
add_filter( 'woocommerce_enable_order_notes_field', '__return_false' );
@deeman
deeman / functions.php
Created July 25, 2020 11:46
WooCommerce: Change the Add to Cart text
<?php
//For the ‘single’ product page, let’s add the following:
// Change 'add to cart' text on single product page
add_filter( 'woocommerce_product_single_add_to_cart_text', 'bryce_add_to_cart_text' );
function bryce_add_to_cart_text() {
return __( 'Yes! I WANT this!', 'your-slug' );
}
//But then what about on the ‘archive’ product pages? Add this:
// Change 'add to cart' text on archive product page
add_filter( 'woocommerce_product_add_to_cart_text', 'bryce_archive_add_to_cart_text' );
@deeman
deeman / functions.php
Created July 12, 2020 11:53
Dequeue Google Fonts in WordPress
add_filter( 'style_loader_src', function($href){
if(strpos($href, "//fonts.googleapis.com/") === false) {
return $href;
}
return false;
});