Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@fitzhaile
fitzhaile / is_blog.php
Created August 28, 2014 22:15
An is_blog() conditional function for Wordpress.
<?php
/**
* An is_blog() conditional function for Wordpress.
*
* Determines if the current page is blog(y), including:
*
* - Posts page
* - Archive (category, tag, author)
* - Single post
@fitzhaile
fitzhaile / custom_excerpt.php
Last active March 24, 2016 18:36
Custom excerpt options for Wordpress.
<?php
/**
* A replacement for the default wp_trim_excerpt().
*
* Generates an excerpt from the_content, if needed.
*
* It is similar (identical) to the default to allow filters other than our own to work,
* with the exception that it uses our default my_trim_words() function.
*
@fitzhaile
fitzhaile / bem-nav.php
Last active April 17, 2017 15:26
Alternative BEM-based lib/nav.php for Roots Theme
<?php
/**
* Cleaner, BEM-based walker for wp_nav_menu()
*
* (Attempts to adhere more to http://cssguidelin.es.)
*
* NOTE: This apprroach requires substitute arguments to be passed to wp_nav_menu().
*
* 'nav_class' - Class attached to the <nav> element that contains the menu.
* It is used to generate classes for the ul, li and anchor elements. For example,
@fitzhaile
fitzhaile / woocommerce_variable_fields.php
Last active August 29, 2015 14:06 — forked from corsonr/gist:9152652
WooCommerce Custom Fields for Variations
<?php
//Display Fields
add_action( 'woocommerce_product_after_variable_attributes', 'my_variable_fields', 10, 2 );
//JS to add fields for new variations
add_action( 'woocommerce_product_after_variable_attributes_js', 'my_variable_fields_js' );
//Save variation fields
add_action( 'woocommerce_process_product_meta_variable', 'my_save_variable_fields', 10, 1 );
/**
@fitzhaile
fitzhaile / 0_reuse_code.js
Last active August 29, 2015 14:21
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