Skip to content

Instantly share code, notes, and snippets.

@bob-moore
bob-moore / 0_reuse_code.js
Last active August 29, 2015 14:25
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@bob-moore
bob-moore / mobile_dropdown.js
Created January 15, 2016 15:05
Hover Touch Menu THingy
jQuery( document ).ready(function($) {
'use strict';
if (!Modernizr.touch) {
return;
}
var link = $(menu_item).children( 'a' );
var sub_menu = $(menu_item).children( 'ul' );
$( link ).on( 'click', function( e ) {
if( $(sub_menu).css('visibility') == 'hidden' ) {
@bob-moore
bob-moore / wp-query-ref.php
Created February 25, 2016 14:12 — forked from luetkemj/wp-query-ref.php
WP: Query $args
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/3.9/src/wp-includes/query.php
*/
$args = array(
@bob-moore
bob-moore / widget_title_filter.php
Last active March 3, 2016 17:41
Filter for removing widget titles that start with !
<?php
if( !function_exists( 'mpress_remove_widget_titles' ) ) {
function mpress_remove_widget_titles( $widget_title ) {
if( substr( $widget_title, 0, 1 ) === '!' ) {
return;
}
return $widget_title;
}
add_filter( 'widget_title', 'mpress_remove_widget_titles' );
( function($) {
'use strict';
$.fn.ToggleTabMenu = function() {
function Tab( el ) {
var tab = {
init : function( el ) {
this.$el = $( el );
this.cacheDom();
},
cacheDom : function() {
@bob-moore
bob-moore / waypoint_jquery_usage.js
Created March 25, 2016 15:53
Basic Waypoint Usage
// Document ready function
jQuery( document ).ready(function($) {
'use strict';
// Define our elements so we can cache them
var $masthead = $( '$masthead' );
var $body = $( 'body' );
// Use waypoints
$body.waypoint( function( direction ) {
if( direction === 'down' ) {
//do stuff you want to happen on down
@bob-moore
bob-moore / sample.html
Last active June 8, 2016 17:18
Toggle Element inside clickable div
<div class="togglevisible" data-click-target=".inner">
<p>alksjdfkajsdfkaskdfj</p>
<div class="inner">
<p>this is a paragraph</p>
<a href="http://google.com" target="_blank">link</a>
</div>
</div>
@bob-moore
bob-moore / bands_loop.php
Created May 26, 2016 15:26
Wordpress loop for bands post type
<main id="main" class="site-main" role="main">
<?php
// WP_Query arguments
$args = array (
'post_type' => array( 'band' ),
'post_status' => array( 'publish' ),
'nopaging' => true,
'posts_per_page' => '-1',
'order' => 'ASC',
'orderby' => 'menu_order',
@bob-moore
bob-moore / .txt
Created May 31, 2016 13:15
.htaccess Code Samples
## Permanently Redirect Entire Domain
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example.com [NC,OR]
RewriteCond %{HTTP_HOST} ^www.example.com [NC]
RewriteRule ^(.*)$ http://example.net/$1 [L,R=301,NC]
@bob-moore
bob-moore / customizer.php
Last active June 2, 2016 19:01
Default Featured Images
<?php
/**
* mpress Theme Customizer.
* @package mpress
*/
class Mpress_Theme_Customizer {
private $sections;
private $settings;
private $controls;