This file contains hidden or 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_filter( 'widget_text', 'do_shortcode' ); | |
?> |
This file contains hidden or 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 RULE TO SECTION | |
add_filter('acf/location/rule_types', 'acf_location_rules_types'); | |
function acf_location_rules_types( $choices ) | |
{ | |
$choices['Other']['taxonomy_depth'] = 'Taxonomy Depth'; | |
return $choices; | |
} |
This file contains hidden or 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_filter('acf/load_field/name=custom_field', 'populate_custom_field'); | |
function populate_custom_field( $field ) { | |
global $post; | |
$postID = $post->ID; | |
$field['default_value'] = 'Default Value'; | |
} | |
?> |
This file contains hidden or 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_filter( 'woocommerce_order_item_name', 'add_sample_prefix', 20, 3 ); | |
function add_sample_prefix( $item_name, $item, $is_visible ) { | |
$item_name .= ' - new name'; | |
return $item_name; | |
} | |
?> |
This file contains hidden or 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_order_status_changed', 'auto_complete_virtual_orders'); | |
function auto_complete_virtual_orders($order_id) { | |
if ( ! $order_id ) { | |
return; | |
} | |
$order = wc_get_order( $order_id ); | |
if ($order->data['status'] == 'processing') { |
This file contains hidden or 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_filter( 'woocommerce_product_filters', 'products_custom_backend_filter' ); | |
function products_custom_backend_filter( $output ) { | |
global $wp_query; | |
$output .= wc_product_dropdown_categories( array( | |
'show_option_none' => 'Filter by brands', // Replace with your own placeholder | |
'taxonomy' => 'pa_brand', // Replace with your own attribute | |
'name' => 'pa_brand', // Replace with your own attribute |
This file contains hidden or 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 full_products_loop() { | |
if ( ! is_admin() ) { | |
if(!function_exists('wc_get_products')) { | |
return; | |
} | |
ob_start(); |
This file contains hidden or 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 | |
// Shortcode attributes: Limit, Category, Key | |
function custom_product_loop( $atts ) { | |
// Attributes | |
$atts = shortcode_atts( | |
array( | |
'limit' => -1, |
This file contains hidden or 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_filter( 'woocommerce_product_addons_option_price', 'filter_product_addons_option_price', 10, 4 ); | |
function filter_product_addons_option_price( $price, $option, $i, $type ){ | |
if ( $option['price'] == 0 ) { | |
$price = ''; | |
} | |
return $price; | |
} |