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 throttle( fn, time ) { | |
var t = 0; | |
return function() { | |
var args = arguments, ctx = this; | |
clearTimeout(t); | |
t = setTimeout( function() { | |
fn.apply( ctx, args ); | |
}, time ); | |
}; |
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
/* Extra small devices (phones, up to 480px) */ | |
/* No media query since this is the default in Bootstrap */ | |
/* Small devices (tablets, 768px and up) */ | |
@media (min-width: @screen-sm) { ... } | |
/* Medium devices (desktops, 992px and up) */ | |
@media (min-width: @screen-md) { ... } | |
/* Large devices (large desktops, 1200px and up) */ |
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
/* Smartphones (portrait and landscape) ----------- */ | |
@media only screen | |
and (min-width : 320px) | |
and (max-width : 480px) { | |
/* Styles */ | |
} | |
/* Smartphones (landscape) ----------- */ | |
@media only screen | |
and (min-width : 321px) { |
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 | |
/** | |
* Send debug code to the Javascript console | |
*/ | |
function debug_to_console($data) { | |
if(is_array($data) || is_object($data)) | |
{ | |
echo("<script>console.log('PHP: ".json_encode($data)."');</script>"); | |
} else { | |
echo("<script>console.log('PHP: ".$data."');</script>"); |
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
$gallery = get_post_gallery( $post, false ); | |
$ids = explode( ",", $gallery['ids'] ); | |
foreach( $ids as $id ) { | |
$link = wp_get_attachment_url( $id ); | |
$image = wp_get_attachment_image( $id, "thumbnail"); | |
echo( "<div class='item'><a href='$link'>" . $image . "</a></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
// WP_Query arguments | |
$args = array ( | |
'category_name' => 'gallery', | |
); | |
// The Query | |
$query = new WP_Query( $args ); | |
// The Loop | |
if ( $query->have_posts() ) { |
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
public static function get_form_summary(){ | |
global $wpdb; | |
$form_table_name = self::get_form_table_name(); | |
$lead_table_name = self::get_lead_table_name(); | |
$sql = "SELECT l.form_id, count(l.id) as unread_count | |
FROM $lead_table_name l | |
WHERE is_read=0 AND status='active' | |
GROUP BY form_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
function pw_show_gallery_image_urls( $content ) { | |
global $post; | |
// Only do this on singular items | |
if( ! is_singular() ) | |
return $content; | |
// Make sure the post has a gallery in it | |
if( ! has_shortcode( $post->post_content, 'gallery' ) ) |
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() { | |
$('a[href*=#]:not([href=#])').click(function() { | |
if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') | |
|| location.hostname == this.hostname) { | |
var target = $(this.hash); | |
target = target.length ? target : $('[name=' + this.hash.slice(1) +']'); | |
if (target.length) { | |
$('html,body').animate({ | |
scrollTop: target.offset().top |
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
// Disable support for comments and trackbacks in post types | |
function df_disable_comments_post_types_support() { | |
$post_types = get_post_types(); | |
foreach ($post_types as $post_type) { | |
if(post_type_supports($post_type, 'comments')) { | |
remove_post_type_support($post_type, 'comments'); | |
remove_post_type_support($post_type, 'trackbacks'); | |
} | |
} | |
} |
OlderNewer