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_my_account_my_orders_actions', 'what_is_this_pay_link_you_speak_of', 2, 10); | |
function what_is_this_pay_link_you_speak_of( $actions ){ | |
// Replace $actions['pay'] with $actions['cancel'] or $actions['view'] as needed. | |
if( $actions['pay'] ){ | |
unset($actions['pay']); | |
} | |
return $actions; |
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 | |
# the neat way using WooCommerce filter | |
function remove_wc_product_cat_hierarchy($args){ | |
$args['rewrite']['hierarchical'] = false; | |
return $args; | |
} | |
add_filter('woocommerce_taxonomy_args_product_cat', 'remove_wc_product_cat_hierarchy'); |
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 getTelegramAvatar($username='') | |
{ | |
$username = $username; | |
$username = str_replace('@', '', $username); | |
$baseURL = 'https://telegram.me/'; | |
$pageURL = $baseURL . $username; |
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_checkout_fields' , 'default_values_checkout_fields' ); | |
// You can use this for postcode, address, company, first name, last name and such. | |
// field names can be found here: | |
// https://docs.woocommerce.com/document/tutorial-customising-checkout-fields-using-actions-and-filters/ | |
// found the main function woocommerce_form_field() here: | |
// https://github.com/woocommerce/woocommerce/blob/76b32c9aa52ebac70fe5a60a8d56351218760471/includes/wc-template-functions.php | |
function default_values_checkout_fields( $fields ) { |
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 woocommerce_show_all_the_orders_in_account($arr){ | |
$arr['limit'] = -1; | |
return $arr; | |
} | |
add_filter('woocommerce_my_account_my_orders_query', 'woocommerce_show_all_the_orders_in_account'); | |
?> |
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 | |
public function SpannyTitle( $id = null, $return = true){ | |
$pid = ($id) ? $id : get_the_ID(); | |
$title = get_the_title($pid); | |
$title = explode(' ', $title); | |
foreach( $title as $titlenum => $titletext ){ | |
$titlenew .= '<span class="title-num-' . ($titlenum + 1) . '">' . $titletext . ' </span>'; | |
} | |
if( $return ){ |
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 PRODUCTS TO THE FEED | |
add_action('pre_get_posts', 'add_products_to_the_feed'); | |
function add_products_to_the_feed($query){ | |
if( is_feed() && is_main_query() ){ | |
$query->set('post_type', array('post', 'product')); | |
} |
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 off_percentage($id=null){ | |
$pid = ($id) ? $id : get_the_ID(); | |
$product = new WC_Product($pid); | |
$sale_price = $product->sale_price; | |
$regu_price = $product->regular_price; | |
$percentage = round( ( ( $regu_price - $sale_price ) / $regu_price ) * 100 ); | |
return $percentage; | |
} |
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; | |
$sale_price = $product->sale_price; | |
$regu_price = $product->regular_price; | |
$percentage = round( ( ( $regu_price - $sale_price ) / $regu_price ) * 100 ); | |
?> |
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 ThumbnailAddress( $id = false, $echo = true, $size = "fullsize" ) { | |
global $post; | |
if( !$id ){ | |
$thumb = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), $size ); | |
} else { | |
$thumb = wp_get_attachment_image_src( get_post_thumbnail_id($id), $size ); | |
} | |
if( $echo == true ){ |