Skip to content

Instantly share code, notes, and snippets.

View Deaner666's full-sized avatar

Dave Dean Deaner666

View GitHub Profile
@Deaner666
Deaner666 / functions.php
Last active November 13, 2015 22:26
Add a text area for details meta on a WooCommerce product category edit term page
<?php
add_action( 'product_cat_edit_form_fields', 'wpm_product_cat_edit_details_meta' );
/**
* Add a details metabox to the Edit Product Category page.
*
* For adding a details metabox to the WordPress admin when
* editing an existing product category in WooCommerce.
*
* @param object $term The existing term object.
@Deaner666
Deaner666 / functions.php
Created November 14, 2015 07:47
Save the WooCommerce product_cat details meta field passed by the add or edit category page
<?php
add_action( 'create_product_cat', 'wpm_product_cat_details_meta_save' );
add_action( 'edit_product_cat', 'wpm_product_cat_details_meta_save' );
/**
* Save Product Category details meta.
*
* Save the product_cat details meta POSTed from the
* edit product_cat page or the add product_cat page.
*
@Deaner666
Deaner666 / functions.php
Created November 14, 2015 11:06
Display the details meta field on a WooCommerce product_cat term archive
<?php
add_action( 'woocommerce_after_shop_loop', 'wpm_product_cat_display_details_meta' );
/**
* Display details meta on Product Category archives.
*
*/
function wpm_product_cat_display_details_meta() {
if ( ! is_tax( 'product_cat' ) ) {