This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Register term fields | |
*/ | |
add_action( 'init', 'register_vendor_custom_fields' ); | |
function register_vendor_custom_fields() { | |
add_action( WC_PRODUCT_VENDORS_TAXONOMY . '_add_form_fields', 'add_vendor_custom_fields' ); | |
add_action( WC_PRODUCT_VENDORS_TAXONOMY . '_edit_form_fields', 'edit_vendor_custom_fields', 10 ); | |
add_action( 'edited_' . WC_PRODUCT_VENDORS_TAXONOMY, 'save_vendor_custom_fields' ); | |
add_action( 'created_' . WC_PRODUCT_VENDORS_TAXONOMY, 'save_vendor_custom_fields' ); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function custom_wc_ajax_variation_threshold( $qty, $product ) { | |
return 10; | |
} | |
add_filter( 'woocommerce_ajax_variation_threshold', 'custom_wc_ajax_variation_threshold', 10, 2 ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function hwid_load_custom_tab( $tab_key, $tab_info ) { | |
echo apply_filters( 'the_content', $tab_info['tabContent'] ); | |
} | |
function hwid_add_content_tabs( $tabs ) { | |
global $post; | |
$custom_tabs = get_field( 'tabs', $post->ID ); | |
foreach( $custom_tabs as $index => $tab ) { | |
$tabs['customTab-' . $index] = array( | |
'title' => $tab['tab_title'], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if( function_exists('acf_add_local_field_group') ): | |
acf_add_local_field_group(array ( | |
'key' => 'acf_product_options', | |
'title' => 'Product Options', | |
'fields' => array ( | |
array ( | |
'key' => 'acf_product_options_tabbedcontent_label', | |
'label' => 'Tabbed Content', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Add these to your wp-config.php file. | |
ini_set('display_errors','Off'); | |
ini_set('error_reporting', E_ALL ); | |
define('WP_DEBUG', false); | |
define('WP_DEBUG_DISPLAY', false); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<a href="#idname"><img src="img/url" /></a> | |
<h1 id="#idname">title</h1> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action('restrict_manage_posts', 'featured_products_sorting'); | |
function featured_products_sorting() { | |
global $typenow; | |
$post_type = 'product'; // change to your post type | |
$taxonomy = 'product_visibility'; // change to your taxonomy | |
if ($typenow == $post_type) { | |
$selected = isset($_GET[$taxonomy]) ? $_GET[$taxonomy] : ''; | |
$info_taxonomy = get_taxonomy($taxonomy); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Bypass logout confirmation. | |
*/ | |
function iconic_bypass_logout_confirmation() { | |
global $wp; | |
if ( isset( $wp->query_vars['customer-logout'] ) ) { | |
wp_redirect( str_replace( '&', '&', wp_logout_url( wc_get_page_permalink( 'myaccount' ) ) ) ); | |
exit; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'woocommerce_no_products_found', 'show_products_on_no_products_found', 20 ); | |
function show_products_on_no_products_found() { | |
echo '<h2>' . __( 'You may be interested in...', 'domain' ) . '</h2>'; | |
echo do_shortcode( '[featured_products per_page="4"]' ); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Check if a specific product category is in the cart | |
*/ | |
function wc_ninja_category_is_in_the_cart() { | |
// Add your special category slugs here | |
$categories = array( 'clothing', 'posters' ); | |
// Products currently in the cart | |
$cart_ids = array(); |