Skip to content

Instantly share code, notes, and snippets.

View ccurtin's full-sized avatar
🤙
makka thangs

Christopher James Curtin ccurtin

🤙
makka thangs
View GitHub Profile
@ccurtin
ccurtin / Scroll to a target ID on a different page.js
Last active October 7, 2016 17:52
Scroll to a target ID on a different page.
// Scrolling to an ID on different page
(function($) {
$('body').bind('touchstart', function() {});
var jump = function(e) {
if (e) {
var target = $(this).attr("href");
} else {
var target = location.hash;
}
@ccurtin
ccurtin / Add CPTs to main_query on archive page.php
Last active October 7, 2016 17:52
Add CPTs to main_query on archive page
<?php
function namespace_add_custom_types( $query ) {
if( is_category() || is_tag() && empty( $query->query_vars['suppress_filters'] ) ) {
$query->set( 'post_type', array(
'post', 'nav_menu_item', 'your-custom-post-type-here'
));
return $query;
}
}
add_filter( 'pre_get_posts', 'namespace_add_custom_types' );
@ccurtin
ccurtin / Add active class to links.js
Last active October 7, 2016 17:52
Add and active class to a link within a conainer
@ccurtin
ccurtin / Set Sublime Text to open when git commit message is left empty (Windows).sh
Created June 30, 2015 14:09
Set Sublime Text to open when git commit message is left empty (Windows)
git config --global core.editor "'/location/of/../sublime_text.exe' -w"
@ccurtin
ccurtin / Wordpress: redirect attachment pages to homepage url.php
Created July 2, 2015 17:55
Wordpress: redirect attachment pages to homepage url
<?php
/*
* Redirect Attachment Pages
*/
add_action( 'template_redirect', 'wpse27119_template_redirect' );
function wpse27119_template_redirect()
{
// Get out of here if not headed to an attachment page
if( ! is_attachment() ) return;
@ccurtin
ccurtin / Wordpress-ACF-backstretch-loop.php
Created July 6, 2015 19:00
Wordpress-ACF-backstretch-loop
<?php
// Services Pages background images fade.
if ( is_page_template( 'page-services-single.php' ) ) : ?>
<?php
// check if the repeater field has rows of data
if( have_rows('background_images') ):
// create an empty array
$images = array();
// loop through the rows of data
@ccurtin
ccurtin / Javascript:jQuery: Remove Inline Styles.js
Last active August 29, 2015 14:24
Javascript:jQuery: Remove Inline Styles
/// REMOVE STYLES plugin
// http://stackoverflow.com/questions/2465158/is-it-possible-to-remove-inline-styles-with-jquery
// USE: $('#element').removeStyle('display');
(function($) {
$.fn.removeStyle = function(style) {
var search = new RegExp(style + '[^;]+;?', 'g');
return this.each(function() {
if ($(this).attr("style")) {
@ccurtin
ccurtin / Conditionizr.Detects.js
Last active January 27, 2017 12:40
Conditionizr Examples/Detects
/*!
* Firefox
* Evaluate the presence of `InstallTrigger`
*/
conditionizr.add('firefox', function () {
return 'InstallTrigger' in window;
});
/*!
* IE6
* @cc_on Conditional Compilation to test the
@ccurtin
ccurtin / PHP-Accessor-Crash-Course.php
Last active August 29, 2015 14:26
PHP-Accessor-Crash-Course
/*
*
* PHP Accessors
*
*/
// 'protected' and 'private' can ONLY be accessed from WITHIN the classes themselves. NOT OUTSIDE.
// EX: instantiating an object then calling a protected or private method or property will throw an error.
// Only 'public' methods and properties can be accessed OUTSIDE the classes themselves
class parent_Class