/**
* Get Youtube video ID from URL
*
* @param string $url
* @return mixed Youtube video ID or FALSE if not found
*/
function getYoutubeIdFromUrl($url) {
$parts = parse_url($url);
if(isset($parts['query'])){
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
var selector = 'img' // Replace this with the selector for the element you want to make transformable | |
jQuery.getScript('//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js', function() { | |
jQuery.getScript('//cdnjs.cloudflare.com/ajax/libs/numeric/1.2.6/numeric.min.js', function() { | |
(function() { | |
var $, applyTransform, getTransform, makeTransformable; | |
$ = jQuery; |
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
// WooCommerce category product count | |
add_filter( 'woocommerce_subcategory_count_html', 'jk_hide_category_count' ); | |
function jk_hide_category_count() { | |
// No count | |
} |
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
// WooCommerce shop columns | |
add_filter('loop_shop_columns', 'loop_columns'); | |
if (!function_exists('loop_columns')) { | |
function loop_columns() { | |
return 3; // 3 products per row | |
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
<?php | |
// Get the tags | |
$tags = get_the_tags(); | |
// Count total tags | |
$total_tags = count($tags); | |
// Set $i | |
$i=0; |
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://www.google.com/maps/dir/Current+Location/Streetname%20housenumber+postalnumbers+postalletters+city |
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/a/8028584 | |
function getScrollPercent() { | |
var h = document.documentElement, | |
b = document.body, | |
st = 'scrollTop', | |
sh = 'scrollHeight'; | |
return (h[st]||b[st]) / ((h[sh]||b[sh]) - h.clientHeight) * 100; | |
} | |
document.addEventListener('scroll', function(){ |
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
<?php $args = array('post_type' => 'posttype', 'post__not_in' => array($post->ID), ); ?> | |
<?php $query = new wp_query( $args ); ?> | |
<?php if($query->have_posts()): ?> | |
<?php while( $query->have_posts() ) : ?> | |
<?php $query->the_post(); ?> | |
// All Post relative stuff here | |
<?php the_title(); ?> | |
<?php echo esc_url( get_post_permalink() ); ?> |
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
<?php $locations = get_nav_menu_locations(); ?> | |
<?php $menu = wp_get_nav_menu_object( $locations['theme_location'] ); ?> | |
<?php $menu_items = wp_get_nav_menu_items( $menu->term_id ); ?> | |
<ul class="list-group list-group-flush"> | |
<?php foreach ( (array) $menu_items as $key => $menu_item ): ?> | |
<li class="list-group-item list-group-item-action"> | |
<a href="<?= $menu_item->url; ?>"> | |
<?= $menu_item->title; ?> |
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
<?php | |
$api_key = 'YOUR_PLACES_API_KEY'; | |
$place_id = 'PLACE_ID'; | |
$file = file_get_contents( 'https://maps.googleapis.com/maps/api/place/details/json?placeid=' . $place_id . '&key=' . $api_key ); | |
$json = json_decode( $file ); | |
if ( is_object( $json ) ) : | |
foreach ( $json->result->reviews as $review ) : |
OlderNewer