Skip to content

Instantly share code, notes, and snippets.

Avatar

Brad Dalton braddalton

View GitHub Profile
View single post post hero image overlay text.html
<section class="widget_text widget widget_custom_html"><div class="widget_text widget-wrap">
<div class="textwidget custom-html-widget"><p>Change the overlay text for the front page hero image section.</p>
<p><a class="button hero-button" href="#front-page-2">Start Your Journey</a></p></div></div></section>
View front page hero overlay text.html
<section class="widget_text widget widget_custom_html"><div class="widget_text widget-wrap">
<div class="textwidget custom-html-widget"><h1 class="widget-title">Front Page Title</h1><p>Change the overlay text for the front page hero image section.</p>
<p><a class="button hero-button" href="#front-page-2">Start Your Journey</a></p></div></div></section>
@braddalton
braddalton / functions.php
Last active Sep 29, 2022
Remove post date (entry-time) sitewide and (comments-link) on homepage - Genesis https://wpsites.net/?p=110841
View functions.php
add_filter( 'genesis_post_info', 'your_post_info_filter' );
function your_post_info_filter($post_info) {
$front = 'by [post_author_posts_link] [post_edit]';
$post_info = 'by [post_author_posts_link] [post_comments] [post_edit]';
$output = is_front_page() ? $front : $post_info;
return $output;
}
View author pro books archive page template
function genesis_author_pro_book_author(){
global $Genesis_Author_Pro_CPT;
$terms = wp_get_post_terms( get_the_ID(), $Genesis_Author_Pro_CPT->author );
if ( empty( $terms ) || is_wp_error( $terms ) ){
return;
}
View Add product date WooCommerce
add_action( 'woocommerce_single_product_summary', 'add_product_date', 25 );
function add_product_date() {
if ( is_product() && ! empty( get_post_meta( get_the_ID(), 'product_date', true ) ) ) {
echo do_shortcode('[post_date]');
}
}
@braddalton
braddalton / remove setup header
Last active Jun 23, 2022
Remove WooCommerce Product Admin Header https://wpsites.net/?p=110512
View remove setup header
add_action( 'admin_init', 'remove_setup_header' );
function remove_setup_header() {
echo '<style>#wpadminbar + #wpbody { margin-top:0; }</style>';
}
remove_action( 'in_admin_header', array( 'Automattic\WooCommerce\Internal\Admin\Loader', 'embed_page_header' ) );
View remove woocommerce star rating
add_action( 'woocommerce_before_single_product_summary', 'remove_single_rating' );
function remove_single_rating() {
if ( ! empty ( get_post_meta( get_the_ID(), 'remove_rating', true ) ) ) {
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_rating', 10 );
}
}
@braddalton
braddalton / style.css
Created Jun 16, 2022
WooCommerce Single Product Quantity Discount https://wpsites.net/?p=110494
View style.css
@media only screen and (min-width: 960px) {
.cart-quantity-discount {
display: inline;
color: white;
font-weight: 500;
font-size: 12px;
background: green;
padding-top: 1px;
padding-bottom: 1px;
@braddalton
braddalton / cart.php
Last active Jun 11, 2022
WooCommerce Remove Coupon Form From Cart https://wpsites.net/?p=110461
View cart.php
<?php
/**
* Cart Page
*
* This template can be overridden by copying it to yourtheme/woocommerce/cart/cart.php.
*
* @author Brad Dalton - WP SITES
* @link https://wpsites.net/?p=110461
*/
View Add Custom Subscriber Customer Capabilities WooCommerce
add_action( 'admin_init', 'add_subscriber_capabilities');
function add_subscriber_capabilities() {
$role = get_role( 'subscriber' );
$role->add_cap( 'edit_posts' );
$role->add_cap( 'edit_published_posts' );
$role->add_cap( 'publish_posts' );
$role->add_cap( 'delete_posts' );
$role->add_cap( 'delete_published_posts' );