This file contains 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
$all_countries = WC()->countries->get_countries(); | |
foreach($all_countries as $country_code => $country){ | |
var_dump($country_code); | |
}; |
This file contains 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 fields to the checkout page based on products in cart. | |
* | |
* @how-to https://remicorson.com/?p=7871 | |
* @author Remi Corson | |
* @testedwith WooCommerce 3.4.0 | |
*/ | |
add_action( 'woocommerce_checkout_fields', 'woo_add_conditional_checkout_fields' ); |
This file contains 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
$menu_items = wp_get_nav_menu_items( 'social-menu' ); | |
foreach( $menu_items as $item ) { | |
print_r($item); | |
} |
This file contains 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
https://css-tricks.com/full-width-containers-limited-width-parents/ | |
.full-width { | |
margin-left: calc(-100vw / 2 + 500px / 2); // 500 is container width | |
margin-right: calc(-100vw / 2 + 500px / 2); | |
} |
This file contains 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
//https://stackoverflow.com/questions/53921097/html5-video-pause-for-a-few-seconds-then-continue-playback | |
<video id="video" playsinline muted loop controls autoplay width='300'> | |
<source src="https://html5demos.com/assets/dizzy.mp4" type="video/mp4"/> | |
</video> | |
var video = document.getElementById('video'); | |
video.addEventListener("timeupdate", tick); | |
function tick(e) { | |
var t = this.currentTime; | |
if (t >= 3) { |
This file contains 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
//https://stackoverflow.com/questions/7862233/twitter-bootstrap-tabs-go-to-specific-tab-on-page-reload-or-hyperlink | |
// Javascript to enable link to tab | |
var url = document.location.toString(); | |
if (url.match('#')) { | |
jQuery('.nav-tabs a[href="#' + url.split('#')[1] + '"]').tab('show'); | |
} | |
// Change hash for page-reload | |
jQuery('.nav-tabs a').on('shown.bs.tab', function (e) { | |
window.location.hash = e.target.hash; |
This file contains 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
$skill = ["Advanced", "Essentials", "Intermediate"]; | |
$custom_order = [3, 1, 2]; | |
array_multisort($custom_order, $skill); | |
// after that: $skill becomes ["Essentials", "Intermediate", "Advanced"] |
This file contains 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
//from here: https://stackoverflow.com/a/8888498/6775194 | |
function formatAMPM(date) { | |
var hours = date.getHours(); | |
var minutes = date.getMinutes(); | |
var ampm = hours >= 12 ? 'pm' : 'am'; | |
hours = hours % 12; | |
hours = hours ? hours : 12; // the hour '0' should be '12' | |
minutes = minutes < 10 ? '0'+minutes : minutes; | |
var strTime = hours + ':' + minutes + ' ' + ampm; | |
return strTime; |
This file contains 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
// somewhere inside iframe on succesfull form submit at https://websitewhereiframelives.com(Pardot) | |
window.parent.postMessage({eventId: 'customEvent', data: {val1: '500'}}, "*"); | |
// inside script on webpage | |
window.addEventListener('message', function(message) { | |
if(message.origin === 'https://websitewhereiframelives.com'){ | |
if(message.data.eventId === 'customEvent'){ | |
console.log(message.data.data.val1); | |
} | |
} |
This file contains 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
//you can put that inside any html-element | |
<script>document.write(new Date().getFullYear())</script> |
NewerOlder