Skip to content

Instantly share code, notes, and snippets.

View vishalkakadiya's full-sized avatar
:octocat:

Vishal Kakadiya vishalkakadiya

:octocat:
View GitHub Profile
@vishalkakadiya
vishalkakadiya / manage_columns_wp_admin.php
Last active March 16, 2024 01:08
Manage custom columns with sortable in WordPress Admin side
<?php
/*
* =================================================================================================
* Below both hooks works for custom post types.
* e.g. Suppose we have custom post-type name : Books
* @ref https://codex.wordpress.org/Plugin_API/Action_Reference/manage_$post_type_posts_custom_column
* =================================================================================================
*/
@vishalkakadiya
vishalkakadiya / gist:8769f333897810419f514414f9dbe131
Created May 6, 2016 07:10 — forked from corsonr/gist:9152652
WooCommerce : add custom fields to product variations
<?php
//Display Fields
add_action( 'woocommerce_product_after_variable_attributes', 'variable_fields', 10, 3 );
//JS to add fields for new variations
add_action( 'woocommerce_product_after_variable_attributes_js', 'variable_fields_js' );
//Save variation fields
add_action( 'woocommerce_process_product_meta_variable', 'save_variable_fields', 10, 1 );
/**