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
function has_product(): array { | |
$has_product_page = is_shop() || is_product_category() || is_product_tag() || is_product(); | |
global $post; | |
if ( ! $post ) { | |
return [ false, false, false ]; | |
} |
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
add_filter( 'woocommerce_form_field', 'art_change_woocommerce_form_field', 10, 4 ); | |
/** | |
* Изменение хтмл полей | |
* | |
* @param $field | |
* @param $key | |
* @param $args | |
* @param $value | |
* | |
* @testedwith WooCommerce 7.0 |
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
function art_adding_attributes( $post_id, $xml_node ) { | |
// Ограничиваем работу сниппета нужным импортом | |
$import_id = ( $_GET['id'] ?? ( isset( $_GET['import_id'] ) ? $_GET['import_id'] : 'new' ) ); | |
$attributes_from_string = []; | |
if ( ( '31' === $import_id || '26' === $import_id ) && $xml_node->dimensions ) { | |
$sep = '/'; |
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 | |
class Blow_Roles { | |
public function __construct() { | |
$this->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
/** | |
* Подключение скриптов и стилей только на страницах WooCommerce | |
* | |
* @testedwith WooCommerce 7.0 | |
* @verphp 7.4 | |
* @author Artem Abramovich | |
*/ | |
function art_connection_css_js_only_woocommerce_pages() { | |
if ( ! class_exists( 'Woocommerce' ) ) { |
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
function delete_all_attachments_by_post_type() { | |
global $wpdb; | |
$attachments = $wpdb->get_results( | |
"SELECT meta_value as att_id | |
FROM $wpdb->postmeta | |
INNER JOIN $wpdb->posts | |
ON ($wpdb->posts.ID = $wpdb->postmeta.post_id AND $wpdb->posts.post_type = 'courses') | |
WHERE meta_key = '_thumbnail_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
const path = require( 'path' ); | |
const glob = require( 'glob' ); | |
const defaultConfig = require( "@wordpress/scripts/config/webpack.config" ); | |
const BrowserSyncPlugin = require( 'browser-sync-webpack-plugin' ); | |
const MiniCssExtractPlugin = require( 'mini-css-extract-plugin' ); | |
const CssMinimizerPlugin = require( "css-minimizer-webpack-plugin" ); | |
const CopyPlugin = require( 'copy-webpack-plugin' ); | |
const SpriteLoaderPlugin = require( 'svg-sprite-loader/plugin' ); | |
const { hasBabelConfig } = require( '@wordpress/scripts/utils' ); | |
const TerserPlugin = require( 'terser-webpack-plugin' ); |
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
/** | |
* Скрытие методов доставки на корзине | |
* | |
* @param $needs_shipping | |
* | |
* @return false|mixed | |
* | |
* @testedwith WooCommerce 6.1 | |
* @author Artem Abramovich | |
*/ |
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
add_action( 'wpcf7_before_send_mail', 'replace_email_body', 10, 3 ); | |
/** | |
* @param WPCF7_ContactForm $contact_form | |
* @param bool $abort | |
* @param WPCF7_Submission $submission | |
* | |
* @return void | |
*/ | |
function replace_email_body( $contact_form, $abort, $submission ): void { |
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
/** | |
* Сортировка атрибутов в админке по алфавиту | |
* | |
* @param $attr | |
* | |
* @return array | |
* | |
* @testedwith WooCommerce 6.0 | |
* @author Artem Abramovich | |
*/ |