Skip to content

Instantly share code, notes, and snippets.

Avatar

Evgeny Lukin DxDiagDx

View GitHub Profile
@DxDiagDx
DxDiagDx / functions.php
Created Apr 20, 2020
Storefront: скрыть ссылки в handheld footer bar
View functions.php
add_filter( 'storefront_handheld_footer_bar_links', 'jk_remove_handheld_footer_links' );
function jk_remove_handheld_footer_links( $links ) {
unset( $links['my-account'] );
unset( $links['search'] );
unset( $links['cart'] );
return $links;
}
@DxDiagDx
DxDiagDx / functions.php
Created Apr 20, 2020
Storefront: удалить футер-бар
View functions.php
add_action( 'init', 'jk_remove_storefront_handheld_footer_bar' );
function jk_remove_storefront_handheld_footer_bar() {
remove_action( 'storefront_footer', 'storefront_handheld_footer_bar', 999 );
}
@DxDiagDx
DxDiagDx / function.php
Created Apr 20, 2020
Storefront: добавить ссылку в футер-бар
View function.php
add_filter( 'storefront_handheld_footer_bar_links', 'jk_add_home_link' );
function jk_add_home_link( $links ) {
$new_links = array(
'home' => array(
'priority' => 10,
'callback' => 'jk_home_link',
),
);
$links = array_merge( $new_links, $links );
@DxDiagDx
DxDiagDx / style.css
Created Apr 20, 2020
Storefront - добавить иконку ссылки на главную в футер-бар
View style.css
.storefront-handheld-footer-bar ul li.home > a:before {
content: "\f015";
}
@DxDiagDx
DxDiagDx / functions.php
Created Apr 20, 2020
Добавить фото товаров в шаблон заказа в электронной почте
View functions.php
// Edit order items table template defaults
function sww_add_wc_order_email_images( $table, $order ) {
ob_start();
$template = $plain_text ? 'emails/plain/email-order-items.php' : 'emails/email-order-items.php';
wc_get_template( $template, array(
'order' => $order,
'items' => $order->get_items(),
'show_download_links' => $show_download_links,
@DxDiagDx
DxDiagDx / functions.php
Created Apr 20, 2020
Добавить фото товаров в шаблон заказа в электронной почте (перенос строки)
View functions.php
function sww_edit_order_item_name( $name ) {
return $name . '<br />';
}
add_filter( 'woocommerce_order_item_name', 'sww_edit_order_item_name' );
@DxDiagDx
DxDiagDx / function.php
Created Apr 20, 2020
WooCommerce: добавить РРЦ / МРЦ на страницу товара
View function.php
/**
* @snippet Display RRP/MSRP @ WooCommerce Single Product Page
* @how-to Get CustomizeWoo.com FREE
* @author Rodolfo Melogli
* @compatible WC 3.8
* @donate $9 https://businessbloomer.com/bloomer-armada/
*/
// -----------------------------------------
// 1. Add RRP field input @ product edit page
@DxDiagDx
DxDiagDx / pods.html
Last active May 3, 2020
Вывод произвольного поля в текущей записи
View pods.html
[pods field="my_custom_field"]
[pods]{@my_custom_field}[/pods]
@DxDiagDx
DxDiagDx / function.php
Created Jul 5, 2020
WooCommerce: добавить произвольную вкладку
View function.php
/* Переименовать вкладки в карточке товара */
add_filter( 'woocommerce_product_tabs', 'usota_woo_rename_tab', 98);
function usota_woo_rename_tab($tabs) {
$tabs['additional_information']['title'] = 'Характеристики';
return $tabs;
}
add_filter('woocommerce_product_additional_information_heading', 'usota_product_additional_information_heading');
@DxDiagDx
DxDiagDx / function.php
Last active Aug 4, 2020
Woo: условие вывода для товаров отдельной категории
View function.php
add_action( 'woocommerce_after_single_product_summary', 'bbloomer_single_category_slug' );
function bbloomer_single_category_slug() {
if ( has_term( 'chairs', 'product_cat' ) ) {
echo 'Something';
}
elseif ( has_term( 'tables', 'product_cat' ) ) {
echo 'Something else';
}