Skip to content

Instantly share code, notes, and snippets.

Avatar

Brad Dalton braddalton

View GitHub Profile
@braddalton
braddalton / functions.php
Last active March 2, 2023 18:29
Add Pagination to AgentPress Pro Listings Archive Page https://wpsites.net/?p=111827
View functions.php
<?php // Do NOT copy this opening PHP tag. Code goes at end of functions.php
add_action( 'pre_get_posts', 'agentpress_pro_listings_pagination', 10 );
function agentpress_pro_listings_pagination( $query ) {
if ( ! is_admin() && $query->is_main_query() && is_post_type_archive( 'listing' ) ) {
$query->set( 'posts_per_page', 12 );
}
@braddalton
braddalton / functions.php
Created February 8, 2023 07:15
Reposition WooCommerce Archive Description
View functions.php
remove_action( 'woocommerce_archive_description', 'woocommerce_taxonomy_archive_description', 10 );
remove_action( 'woocommerce_archive_description', 'woocommerce_product_archive_description', 10 );
add_action( 'woocommerce_after_main_content', 'woocommerce_taxonomy_archive_description', 10 );
add_action( 'woocommerce_after_main_content', 'woocommerce_product_archive_description', 10 );
View tag-cloud-title.php
echo '<div class="tag-cloud-title">' . __('Title') . '</div>';
@braddalton
braddalton / functions.php
Last active December 20, 2022 11:43
Custom button before Add to Cart form in WooCommerce Product Page https://wpsites.net/?p=111272
View functions.php
add_action( 'woocommerce_before_add_to_cart_form', 'custom_field_button' );
function custom_field_button() {
$wp = get_post_meta( get_the_ID(), 'wp_button', true );
$acf = class_exists('acf') ? get_field('acf_button') : '';
$field = $acf ? $acf : $wp;
if ( $field && is_singular('product') ) {
@braddalton
braddalton / modify-wc-add-to-cart-text.php
Created December 12, 2022 10:15
Modify Add To Cart Text WooCommerce Single Product https://wpsites.net/?p=111218
View modify-wc-add-to-cart-text.php
add_filter( 'woocommerce_product_single_add_to_cart_text', 'woocommerce_add_to_cart_button_text_single' );
function woocommerce_add_to_cart_button_text_single() {
return ( class_exists( 'woocommerce' ) AND is_product() AND get_the_ID() == 443 ) ? __( 'Custom Cart Button Text', 'woocommerce' ) : __( 'Add To Cart', 'woocommerce' );
}
@braddalton
braddalton / woocommerce-add-to-cart-text.php
Last active December 12, 2022 11:37
Change The Text of The Add To Cart Button On Specific Product Page Read More https://wpsites.net/?p=111218
View woocommerce-add-to-cart-text.php
add_filter( 'woocommerce_product_single_add_to_cart_text', 'woocommerce_add_to_cart_button_text_single' );
function woocommerce_add_to_cart_button_text_single() {
if ( class_exists( 'woocommerce' ) AND is_product() AND get_the_ID() == 443 ) {
return __( 'Custom Cart Button Text', 'woocommerce' );
} else {
return __( 'Add To Cart', 'woocommerce' );
View customize.html
<div class="hero-title-image"><div class="hero-title-container">We help business owners in growth mode break through to the next level.</div><div class="wp-hero-image"><img src="http://dev.local/wp-content/uploads/2022/12/2.png" /></div></div>
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 September 29, 2022 09:25
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;
}