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_product_options_attributes', 'add_custom_attributes_to_product_page'); | |
| function add_custom_attributes_to_product_page(){ | |
| global $product_object; | |
| $attributes = $product_object->get_attributes(); | |
| echo '<div class="options_group"><p class="form-field"><label for="custom_attributes" style="display:block;font-weight:bold;padding-left:10px;font-size:14px">Показать в превью (макс 3) </label><div id="custom_attributes" style="display:flex;flex-wrap:wrap">'; | |
| foreach ($attributes as $attribute) { | |
| $attribute_name = wc_attribute_label($attribute->get_name()); | |
| echo '<div style="width:25%;padding:10px;border:1px solid #ccc;margin:10px;padding-bottom:0px">'; | |
| echo '<strong>'; |
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
| // Theme switcher | |
| const toggleSwitch = document.querySelector('.theme-switcher input[type="checkbox"]'); | |
| function switchTheme(e) { | |
| if (e.target.checked) { | |
| document.documentElement.setAttribute('data-theme', 'night'); | |
| } else { | |
| document.documentElement.setAttribute('data-theme', 'day'); | |
| } | |
| } |
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
| UPDATE wp_options SET option_value = REPLACE(option_value, 'http://old_domen.com', 'https://new_domen.com') WHERE option_name = 'home' OR option_name = 'siteurl'; | |
| UPDATE wp_posts SET guid = REPLACE(guid, 'http://old_domen.com', 'https://new_domen.com'); | |
| UPDATE wp_posts SET post_content = REPLACE(post_content, 'http://old_domen.com', 'https://new_domen.com'); | |
| -- UPDATE table_name | |
| -- SET column_name = REPLACE(column_name, 'https://old_domen.com', 'https://new_domen.com') | |
| -- WHERE column_name LIKE '%https://old_domen.com%'; |
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
| // PERFECT PIXEL SCRIPT | |
| let pPixel = document.querySelector(".pPixel"); | |
| if (pPixel) { | |
| if (pPixel.dataset.show) { | |
| pPixel.innerHTML += | |
| "<style>.pPixel__img{top:0;left:0;position:absolute;width:100%;transition-duration:.3s;pointer-events:none;display:block;z-index:1000;background-repeat:no-repeat;background-position:50% 0px;}.pPixel__img.hd{display:none;}.pPixel__img.inv{filter:invert(100%)}.pPixel__btn{position:fixed;z-index:1000;top:50%;width:60px;height:36px;line-height:30px;text-align:center;color:#fff;cursor:pointer;border:3px solid yellow}.pPixel__hide{border-radius:0 180px 180px 0;background:green;left:0}.pPixel__inv{border-radius:180px 0 0 180px;background: red;right:0}</style>"; | |
| pPixel.innerHTML += | |
| '<div class="pPixel__btn pPixel__hide">hide</div><div class="pPixel__btn pPixel__inv">inv</div>'; |
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
| // Img svg to inline svg | |
| const convertImages = (query, callback) => { | |
| const images = document.querySelectorAll(query); | |
| images.forEach(image => { | |
| fetch(image.src) | |
| .then(res => res.text()) | |
| .then(data => { | |
| const parser = new DOMParser(); | |
| const svg = parser.parseFromString(data, 'image/svg+xml').querySelector('svg'); |