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 | |
//place code in the end of functions.php in theme | |
add_action('template_redirect', 'wc_sku_redirect'); | |
function wc_sku_redirect() { | |
$parseUrl = explode('/', $wp->request); | |
if(isset($parseUrl[0]) && $parseUrl[0] === 'product') { | |
$pid = wc_get_product_id_by_sku($parseUrl[1]); | |
if($pid) { | |
wp_safe_redirect(get_permalink($pid)); | |
exit; |
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
[ | |
{ | |
"id": "new24", | |
"category_id": "new-category", | |
"category_name": "Моя нова категорія", | |
"category_published": true, | |
"name": "Новий товар lab24", | |
"private": false, | |
"price": 199, | |
"pricelist": [ |
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
The MIT License (MIT) | |
Copyright (c) 2015 Textalk | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is | |
furnished to do so, subject to the following conditions: |
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 | |
$tel = get_field( 'tel', 'options' ); | |
echo $tel ? '<a class="header-tel" href="tel:' . preg_replace( "/[^0-9+]/", "", $tel ) . '">' . $tel . '</a>' : ''; |
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
{ | |
"name": "load-google-maps", | |
"version": "1.0.0", | |
"authors": ["Glenn Baker", "Gavin Foley", "Matteo Gaggiano"], | |
"description": "Load Google Maps API using jQuery Deferred.", | |
"main": "load-google-maps.js", | |
"keywords": ["Google Maps", "Async"], | |
"license": ["MIT", "GPL"], | |
"dependencies": { | |
"jquery": ">=1.5" |
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 router = new VueRouter({ | |
mode: "history", | |
base: process.env.BASE_URL, | |
routes | |
}); | |
/** | |
* Async push method | |
*/ | |
router.pushAsync = function(route) { |
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
//backup your dabatase at first | |
UPDATE `wp_posts` SET `post_type` = 'product' WHERE post_type = 'post'; | |
UPDATE `wp_term_taxonomy` SET `taxonomy` = 'product_cat' WHERE `taxonomy` = 'category' |
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 | |
/* | |
*** You van use dash-icons https://developer.wordpress.org/resource/dashicons/ | |
*/ | |
add_action( 'init', 'register_cpts' ); | |
function register_cpts() { | |
register_post_type( 'services', | |
array( | |
'labels' => array( |
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
export default { | |
mounted () { | |
let profile = this.$parent | |
let flag = false | |
while (!flag) { | |
if (has(profile.$refs, 'profileScroll')) { | |
flag = true | |
} else { | |
profile = profile.$parent |
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
var mail_valid = /(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])/; | |
/* Example */ | |
var inputField = $('input[type="email"]'); | |
if( mail_valid.test(inputField.val().toLowerCase()) ) { | |
inputField.parent().addClass('mail-valid'); | |
} else { | |
inputField.parent().removeClass('mail-valid'); | |
} |