Skip to content

Instantly share code, notes, and snippets.

View GauravKhupse's full-sized avatar
🏠
Working from home

Gaurav Khupse GauravKhupse

🏠
Working from home
  • Tata consultancy services
  • Pune
View GitHub Profile
@GauravKhupse
GauravKhupse / gist:4d57ac52dd691a5fb89ea07a6d33da0a
Last active August 12, 2021 10:56
Schema Pro: Backorder availability option in product schema
add_action( 'after_setup_theme', 'add_my_custom_meta_field' );
function add_my_custom_meta_field() {
add_filter( 'wp_schema_pro_availability_options', 'my_extra_schema_field' );
function my_extra_schema_field( $fields ) {
$fields['BackOrder '] = esc_html__( 'BackOrder ', 'wp-schema-pro'
);
@GauravKhupse
GauravKhupse / gist:9d7588b9d8e8166183e18dc1d2891e2c
Created August 25, 2021 10:16
Fixed Backorder instead of On backorder with Woo Commerce fetch availability
add_filter( 'wp_schema_pro_schema_product', 'my_extra_schema_field_mapping', 10, 3 );
/**
* Mapping extra field for schema markup.
*
* @param array $schema Schema array.
* @param array $data Mapping fields array.
* @return array
@GauravKhupse
GauravKhupse / gist:78c94502f25c3a34f74da32737cf44d7
Created September 16, 2021 09:00
We can add price range in product schema. low and high price
add_action( 'after_setup_theme', 'add_my_custom_meta_field' );
function add_my_custom_meta_field() {
add_filter( 'wp_schema_pro_schema_meta_fields', 'my_extra_schema_field' );
add_filter( 'wp_schema_pro_schema_product', 'my_extra_schema_field_mapping', 10, 3 );
}
/**
* Add fields for mapping.
*
* @param array $fields Mapping fields array.
@GauravKhupse
GauravKhupse / gist:b0e4602779f2ee5d24c04cf0cc5813d5
Created September 21, 2021 06:07
servesCuisine field in Food Establishment type.
add_filter( 'wp_schema_pro_schema_meta_fields', 'my_extra_schema_field' );
add_filter( 'wp_schema_pro_schema_local_business', 'my_extra_schema_field_mapping', 10, 3 );
function my_extra_schema_field( $fields ) {
$fields['bsf-aiosrs-local-business']['subkeys']['servesCuisine'] = array( // `bsf-aiosrs-book` used for Book, `bsf-aiosrs-event` will for Event like that.
'label' => esc_html__( 'Serves Cuisine', 'aiosrs-pro' ), // Label to display in Mapping fields
@GauravKhupse
GauravKhupse / gist:012e2291931bc4c5618f1a468cc8c06e
Created September 21, 2021 09:46
aluminiOf repeater field in the person schema
add_action( 'after_setup_theme', 'add_my_custom_meta_field' );
function add_my_custom_meta_field() {
add_filter( 'wp_schema_pro_schema_meta_fields', 'my_extra_schema_field' );
add_filter( 'wp_schema_pro_schema_person', 'my_extra_schema_field_mapping', 10, 3 );
}
/**
* Add fields for mapping.
*
* @param array $fields Mapping fields array.
@GauravKhupse
GauravKhupse / gist:769cfeb192099ccf1abea9e9062444df
Last active July 26, 2023 04:37
Fixed show/hide password issue with account page Astra theme.
.woocommerce form .show-password-input, .woocommerce-page form .show-password-input {
position: relative;
cursor: pointer;
}
.woocommerce form .show-password-input::after, .woocommerce-page form .show-password-input::after {
right: 0.7em;
top: 0.4em;
cursor: pointer;
position: absolute;
@GauravKhupse
GauravKhupse / gist:6b0bf87bd8d10bedfd1b82e6b8ea33b6
Created December 30, 2021 12:32
ServiceCusine field in Local business schema
add_action( 'after_setup_theme', 'add_my_custom_meta_field' );
function add_my_custom_meta_field() {
add_filter( 'wp_schema_pro_schema_meta_fields', 'my_extra_schema_field' );
add_filter( 'wp_schema_pro_schema_local_business', 'my_extra_schema_field_mapping', 10, 3 );
}
/**
* Add fields for mapping.
*
* @param array $fields Mapping fields array.
@GauravKhupse
GauravKhupse / gist:1e22e095b61fbd5e98b65ed94e466892
Created February 4, 2022 09:39
Place field in the Article schema
add_action( 'after_setup_theme', 'add_my_custom_meta_field' );
function add_my_custom_meta_field() {
add_filter( 'wp_schema_pro_schema_meta_fields', 'my_extra_schema_field' );
add_filter( 'wp_schema_pro_schema_article', 'my_extra_schema_field_mapping', 10, 3 );
}
/**
* Add fields for mapping.
*
* @param array $fields Mapping fields array.
@GauravKhupse
GauravKhupse / gist:6f90e6a9499662382b905f2fe558ea18
Last active June 30, 2022 11:41
Added compatibility YITH WooCommerce Brands Add-on Premium for brand field.
add_filter( 'wp_schema_pro_schema_product', 'my_brand_field_mapping', 10, 3 );
/**
* Mapping extra field for schema markup.
*
* @param array $schema Schema array.
* @param array $data Mapping fields array.
* @return array
*/
function my_brand_field_mapping( $schema, $data, $post ) {
@GauravKhupse
GauravKhupse / gist:864af7416335dd2bb2774359582fed20
Last active June 30, 2022 11:41
Added author and publisher same as field URL as home page URL
add_filter( 'wp_schema_pro_schema_review', 'my_extra_schema_field_mapping', 10, 3 );
/**
* Mapping extra field for schema markup.
*
* @param array $schema Schema array.
* @param array $data Mapping fields array.
* @return array
*/
function my_extra_schema_field_mapping( $schema, $data, $post ) {