Skip to content

Instantly share code, notes, and snippets.

@fdeross
Last active March 16, 2021 04:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fdeross/0fea9eb6e3e9f3145f590eb52459490e to your computer and use it in GitHub Desktop.
Save fdeross/0fea9eb6e3e9f3145f590eb52459490e to your computer and use it in GitHub Desktop.
Frosting Product Custom Fields
// Add Custom fields
add_action( 'wcv_after_product_details', 'wcv_frosting_taxonomy' );
function wcv_frosting_taxonomy( $object_id ){
WCVendors_Pro_Form_helper::select2( array(
'post_id' => $object_id,
'id' => 'wcv_custom_taxonomy_holiday[]',
'class' => 'select2',
'custom_tax' => true,
'label' => __('Holidays', 'wcvendors-pro'),
'wrapper_start' => '<div class="all-100">',
'wrapper_end' => '</div>',
'taxonomy' => 'holiday',
'taxonomy_args' => array(
'hide_empty' => 0, ),
'custom_attributes' => array(
'multiple' => 'multiple' ),
)
);
echo '<p class="tip">Culturally or religiously significant dates like Easter, Halloween, Christmas.</p>';
WCVendors_Pro_Form_helper::select2( array(
'post_id' => $object_id,
'id' => 'wcv_custom_taxonomy_occasion[]',
'class' => 'select2',
'custom_tax' => true,
'label' => __('Occasions', 'wcvendors-pro'),
'wrapper_start' => '<div class="all-100">',
'wrapper_end' => '</div>',
'taxonomy' => 'occasion',
'taxonomy_args' => array(
'hide_empty' => 0, ),
'custom_attributes' => array(
'multiple' => 'multiple' ),
)
);
echo '<p class="tip">Special events and social gatherings like Birthday, Prom, Wedding.</p>';
WCVendors_Pro_Form_helper::select2( array(
'post_id' => $object_id,
'id' => 'wcv_custom_taxonomy_for_whom[]',
'class' => 'select2',
'custom_tax' => true,
'label' => __('For Whom', 'wcvendors-pro'),
'wrapper_start' => '<div class="all-100">',
'wrapper_end' => '</div>',
'taxonomy' => 'for_whom',
'taxonomy_args' => array(
'hide_empty' => 0, ),
'custom_attributes' => array(
'multiple' => 'multiple' ),
)
);
echo '<p class="tip">Is this specifically for a boy or girl? Leave blank if the item is gender neutral.</p>';
//Changed to post id to test
WCVendors_Pro_Form_helper::select2( array(
'post_id' => $object_id,
'id' => 'wcv_custom_taxonomy_themes[]',
'class' => 'select2',
'custom_tax' => true,
'label' => __('Themes', 'wcvendors-pro'),
'wrapper_start' => '<div class="all-100">',
'wrapper_end' => '</div>',
'taxonomy' => 'themes',
'taxonomy_args' => array(
'hide_empty' => 0, ),
'custom_attributes' => array(
'multiple' => 'multiple' ,
'data-tags' => 'true' ),
)
);
echo '<p class="tip">Keywords that describe your design like Easter Egg, Diamond, Shark.</br>Just start typing to add your own keyword.</p>';
WCVendors_Pro_Form_helper::select2( array(
'post_id' => $object_id,
'id' => 'wcv_custom_taxonomy_character[]',
'class' => 'select2',
'custom_tax' => true,
'label' => __('Character', 'wcvendors-pro'),
'wrapper_start' => '<div class="all-100">',
'wrapper_end' => '</div>',
'taxonomy' => 'character',
'taxonomy_args' => array(
'hide_empty' => 0, ),
'custom_attributes' => array(
'multiple' => 'multiple' ,
'data-tags' => 'true' ),
)
);
echo '<p class="tip">List any characters like Peter Pan, Aladdin, or Frankenstein?</br>Just start typing to add your own keyword.</p>';
WCVendors_Pro_Form_helper::select2( array(
'post_id' => $object_id,
'id' => 'wcv_custom_taxonomy_sports_team[]',
'class' => 'select2',
'custom_tax' => true,
'label' => __('Sports Team', 'wcvendors-pro'),
'wrapper_start' => '<div class="all-100">',
'wrapper_end' => '</div>',
'taxonomy' => 'sports_team',
'taxonomy_args' => array(
'hide_empty' => 0, ),
'custom_attributes' => array(
'multiple' => 'multiple' ,
'data-tags' => 'true' ),
)
);
echo '<p class="tip">Include the city and team like Bentonville Tigers.</br>Just start typing to add your own keyword.</br></p>';
WCVendors_Pro_Form_helper::select2( array(
'post_id' => $object_id,
'id' => 'wcv_custom_taxonomy_specialty_diet[]',
'class' => 'select2',
'custom_tax' => true,
'label' => __('Specialty Diet', 'wcvendors-pro'),
'wrapper_start' => '<div class="all-100">',
'wrapper_end' => '</div>',
'taxonomy' => 'specialty_diet',
'taxonomy_args' => array(
'hide_empty' => 0, ),
'custom_attributes' => array(
'multiple' => 'multiple' ),
)
);
echo '<p class="tip">Product is made for a special diet like gluten-free or vegan.</p>';
WCVendors_Pro_Form_helper::select2( array(
'post_id' => $object_id,
'id' => 'wcv_custom_taxonomy_age_restricted[]',
'class' => 'select2',
'custom_tax' => true,
'label' => __('Adult Content', 'wcvendors-pro'),
'wrapper_start' => '<div class="all-100">',
'wrapper_end' => '</div>',
'taxonomy' => 'age_restricted',
'taxonomy_args' => array(
'hide_empty' => 0, ),
'custom_attributes' => array(
'multiple' => 'multiple' ),
)
);
echo '<p class="tip">Does this item contain a sexually explicit, vulgar language, or drugs theme?</p>';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment