Skip to content

Instantly share code, notes, and snippets.

View isGabe's full-sized avatar
👨‍💻
:party-code:

Gabriel Luethje isGabe

👨‍💻
:party-code:
View GitHub Profile
@isGabe
isGabe / apply-parent-page-temmplate.php
Created September 6, 2013 18:05
WordPress - Automatically apply a page template to children of a page #WordPress #snippet
/**
* Automatically apply parent page template
*
* Inspired by: http://is.gd/wp_apply_parent_page_template
*/
function fstop_use_parent_page_template() {
// Checks if current post type is a page, rather than a post
if ( is_page() ){
$ancestors = get_post_ancestors( get_the_id() );
@isGabe
isGabe / wordpress-comments.scss
Created September 4, 2013 18:27
WordPress: basic comments style .scss template #wordpress #snippet
/**
* Basic WordPredd comment style template
*
* ** Check your theme's comments templates & tags. _s theme uses .comment-list for the comment container, but yours may differ.
*/
.comment-list{
list-style:none;
margin:0 0 1em;
padding:0;
@isGabe
isGabe / Gruntfile.js
Last active December 21, 2015 13:39
basic grunt files for Compass, SASS, and concatenating and minifying JS
module.exports = function(grunt) {
grunt.initConfig({
watch: {
css: {
files: '**/*.scss',
tasks: ['compass'],
},
},
compass: { // Task
dist: { // Target
@isGabe
isGabe / wp-pagination.php
Created August 7, 2013 04:37
WordPress: Pagination #snippets #WordPress
<?php
// Numeric Page Navigation
function bones_page_navi() {
global $wp_query;
$bignum = 999999999;
if ( $wp_query->max_num_pages <= 1 )
return;
echo '<nav class="pagination">';
@isGabe
isGabe / wp-attachment-gallery.php
Created July 4, 2013 19:27
WordPress: Output all attached images as a gallery #snippet #WordPress
@isGabe
isGabe / wordpress-force-login.php
Created June 21, 2013 16:10
WordPress: force log in to view any page, with redirect to requested URL#snippet #WordPress
<?php
/*
* Password protect a WordPress site, with a redirect to the requested URL after successful login
*
* Based on:
* http://wordpress.stackexchange.com/a/64999
* http://kovshenin.com/2012/current-url-in-wordpress/
*
**/
@isGabe
isGabe / widgets.php
Created June 17, 2013 20:25
Basic WordPress Widget Code #snippet #WordPress
<?php
/*
* Basic WordPress Widget Code
* Save to: /wp-content/theme/widgets.php
* in functions.php or appropriate place: if ($wp_version >= 2.8) require_once(TEMPLATEPATH.'/widgets.php');
*
*/
class MyWidgetName extends WP_Widget
{
@isGabe
isGabe / menu-item-parent-class.php
Created June 13, 2013 22:47
WordPress: Add 'menu-item-parent' to menu lis that contain submenus #WordPress #snippet
/**
* Set our new walker only if a menu is assigned,
* and a child theme hasn't modified it to one level deep
*/
function fstop_nav_menu_args( $args ) {
if ( 1 !== $args[ 'depth' ] && has_nav_menu( 'main-nav' ) ) {
$args[ 'walker' ] = new FStop_Page_Navigation_Walker;
}
return $args;
}
@isGabe
isGabe / mobile-menu-toggle.js
Created June 13, 2013 22:42
jQuery/CSS: Basic mobile menu toggle using, with nested CSS toggle for dropdowns
$('#menu-main-menu').slideToggle(200);
});
$('#menu-main-menu > li.menu-item-parent > a').click(function(e){
$(this).parent().toggleClass('open');
$(this).preventDefault();
});
@isGabe
isGabe / acf-gallery-grid.php
Created June 13, 2013 21:34
WordPress: Output Avdanced Custom Fields Gallery Grid #WordPress #snippet