Skip to content

Instantly share code, notes, and snippets.

@gareth-gillman
Created June 11, 2018 21:17
Show Gist options
  • Save gareth-gillman/0cb54293accdb617d143303c441c3eda to your computer and use it in GitHub Desktop.
Save gareth-gillman/0cb54293accdb617d143303c441c3eda to your computer and use it in GitHub Desktop.
add button to woocommerce category
function gg_cat_btn() {
if( is_tax( 'product_cat' ) ) {
add_action( 'woocommerce_after_shop_loop_item_title', 'gg_readmore_btn' );
}
}
add_filter( 'woocommerce_after_shop_loop_item', 'gg_cat_btn' );
function gg_readmore_btn() {
echo '<a class="cat-btn" href="'.get_permalink().'">'.__( 'Book / Get quote!', 'your-plugin' ).'</a>';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment