Posts

Showing posts from May, 2015

How to add custom checkout fields in woocommerce wordpress

for add a custom field in checkout form in woocommerce use below code and customize as per your need. // below filter use for display field at frontend side add_filter( 'woocommerce_shipping_fields' , 'rj_shipping_phone_field' ); function rj_shipping_phone_field( $fields ) {       $fields['shipping_phone'] = array(         'label'         => __( 'Phone', 'woocommerce' ),         'required'      => true,         'class'         => array( 'form-row-first' ),         'clear'         => true,         'validate'      => array( 'phone' ),     );     return $fields; } // below filter use for display custom field in admin side add_filter( 'woocommerce_admin_shipping_fields' , 'rj_admin_shipping_phone_field' ); function rj_admin_shipping_pho...

How to add wordpress wysing editor to post category's description textarea

First need to remove html tag remove filter from description value by bellow filter description will accepts html content also remove_filter( 'pre_term_description', 'wp_filter_kses' ); remove_filter( 'term_description', 'wp_kses_data' ); for add wysing editor to category description just copy and past below class class Visual_Term_Description_Editor { public $taxonomies; public function __construct( $taxonomies ) { /* Setup the class variables */ $this->taxonomies = (array) $taxonomies; /* Only users with the "publish_posts" capability can use this feature */ if ( current_user_can( 'publish_posts' ) ) { /* Remove the filters which disallow HTML in term descriptions */ remove_filter( 'pre_term_description', 'wp_filter_kses' ); remove_filter( 'term_description', 'wp_kses_data' ); /* Add filters to disallow unsafe HTML tags */ if ( ! current_user_can( 'unfi...