Skip to content

Instantly share code, notes, and snippets.

Avatar

Joe Conlin vandigroup

View GitHub Profile
@vandigroup
vandigroup / _smooth-scroll.js
Created Feb 8, 2016
Easy to use smooth scroll to page anchors.
View _smooth-scroll.js
// Smooth scroll to page anchors
$(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
}, 1000);
@vandigroup
vandigroup / _wpadmin_functions.php
Last active Feb 9, 2016
Wordpress functions for tweaking the admin.
View _wpadmin_functions.php
<?php
/**
* Admin customizations
*/
// Change the goofy "Howdy" greeting
function remove_howdy( $translated, $text, $domain ) {
if ( !is_admin() || 'default' != $domain )
return $translated;
if ( false !== strpos($translated, 'Howdy') )
@vandigroup
vandigroup / _custom-mixins.scss
Created Feb 8, 2016
Current collection of mixins I use on all projects.
View _custom-mixins.scss
// Top left block to see what breakpoint you are on.
.mq-block {
position: fixed;
top: 0;
left: 0;
width: 10px;
height: 10px;
content: " ";
z-index: 999999;
}
@vandigroup
vandigroup / gist:bda91a9e963e40110667
Created Feb 2, 2016
Get ALL images from a post, INCLUDING featured and gallery images.
View gist:bda91a9e963e40110667
<?php
$attachments = get_children(array(
'post_parent' => $post->ID,
'post_status' => 'inherit',
'post_type' => 'attachment',
'post_mime_type' => 'image',
'order' => 'ASC'
));
$i = 0;
@vandigroup
vandigroup / gist:141ed124cc586f0c0eda
Created Feb 2, 2016
Get ALL gallery images from a post, NOT limited to only the first post.
View gist:141ed124cc586f0c0eda
<?php
$galleries = get_post_galleries( $post, FALSE );
$i = 0;
foreach ( $galleries as $key => $gallery) {
$images = $gallery['src'];
foreach ($images as $key => $img) {
if( $i < 4 ) {
echo '<img src="' . $img . '" alt="">';
}
$i++;
View Get computed CSS styles with jQuery
/*
Grab CSS styles with jQuery...
To call it:
getStyle(document.getElementById("container"), "font-size")
*/
function getStyle(oElm, strCssRule){
var strValue = "";
if(document.defaultView && document.defaultView.getComputedStyle){
strValue = document.defaultView.getComputedStyle(oElm, "").getPropertyValue(strCssRule);
You can’t perform that action at this time.