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 remove_woo_commerce_hooks() { | |
global $avada_woocommerce; | |
if(is_home() || is_front_page()) : | |
remove_action( 'woocommerce_after_shop_loop_item', array( $avada_woocommerce, 'show_details_button' ), 15 ); | |
remove_action( 'woocommerce_after_shop_loop_item', array( $avada_woocommerce, 'template_loop_add_to_cart' ), 10 ); | |
endif; | |
} | |
add_action( 'wp', 'remove_woo_commerce_hooks' ); |
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 cw_change_product_price_display( $price ) { | |
if(is_singular()) { | |
$price .= '<small>' . ' Excl. GST' . '</small>'; | |
return $price; | |
} | |
else { | |
$price .= '<small>' . ' Excl. GST' . '</small>'; | |
return $price; |
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 | |
/** __________________________________ ENHANCE THE STANDARD SEARCH | |
* Join posts and postmeta tables | |
* This one hels to include the SKU in tzhe standard search | |
* http://codex.wordpress.org/Plugin_API/Filter_Reference/posts_join | |
*/ | |
function cf_search_join( $join ) { | |
global $wpdb; | |
if ( is_search() || !empty($_REQUEST['s'] )) { | |
$join .=' LEFT JOIN '.$wpdb->postmeta. ' ON '. $wpdb->posts . '.ID = ' . $wpdb->postmeta . '.post_id '; |
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( 'template_redirect', 'avada_check_page' ); | |
function avada_check_page() { | |
if ( is_singular( 'product' ) ) { | |
add_action( 'avada_override_current_page_title_bar', 'avada_remove_title_bar' ); | |
} | |
} | |
function avada_remove_title_bar() { | |
} |
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 | |
// https://theme-fusion.com/documentation/avada/woocommerce/override-avada-woocommerce-hooks/ | |
function remove_woo_commerce_hooks() { | |
global $avada_woocommerce; | |
remove_action( 'woocommerce_single_product_summary', array( $avada_woocommerce, 'add_product_border' ), 19 ); | |
} | |
add_action( 'after_setup_theme', 'remove_woo_commerce_hooks' ); |
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 | |
/** | |
* Change the placeholder image | |
*/ | |
add_filter('woocommerce_placeholder_img_src', 'custom_woocommerce_placeholder_img_src'); | |
function custom_woocommerce_placeholder_img_src( $src ) { | |
$upload_dir = wp_upload_dir(); | |
$uploads = untrailingslashit( $upload_dir['baseurl'] ); | |
// replace with path to your image |
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 | |
global $product; | |
$upload_dir = wp_upload_dir(); | |
$file_location = $upload_dir['basedir'].'/'."acf_attached_file".'/'.$product->get_slug().'.pdf'; | |
if(file_exists($file_location)) { | |
echo "file exist"; | |
} | |
else { | |
echo "not exist"; |
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('wp_handle_upload_prefilter', 'pdf_pre_upload'); | |
add_filter('wp_handle_upload', 'pdf_post_upload'); | |
function pdf_pre_upload($file){ | |
add_filter('upload_dir', 'pdf_custom_upload_dir'); | |
return $file; | |
} |
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 | |
// ACF upload prefilter | |
function acf_upload_dir_prefilter($errors, $file, $field) { | |
$upload_dir = wp_upload_dir(); | |
// only allow admin | |
if( !current_user_can('manage_options') ) { | |
$errors[] = 'Only administrators may upload attachments'; | |
} | |
$_filter = false; | |
// This filter changes directory just for item being uploaded |
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('the_posts', 'variation_query'); | |
function variation_query($posts, $query = false) { | |
if (is_search() && !is_admin()) | |
{ | |
$ignoreIds = array(0); | |
foreach($posts as $post) | |
{ |