Skip to content

Instantly share code, notes, and snippets.

View patrickgilmour's full-sized avatar

Pat Gilmour patrickgilmour

  • Self-employed
  • Brookyln, New York, USA
View GitHub Profile
@patrickgilmour
patrickgilmour / woocommerce_show_posts_term_children.php
Created June 27, 2014 00:47
WooCommerce - show a product's single child category (term) from a defined Parent term in the WooCommerce Products taxonomy, 'product_cat'. Works on the Single Product Page.
<?php
/**
* Show a Product's Child Category of a Parent
*
* For example, A parent called "Brand" and a child called "Apple"
*/
add_action('woocommerce_after_single_product', 'my_woocommerce_after_single_product' );
function my_woocommerce_after_single_product () {
@patrickgilmour
patrickgilmour / woocommerce-remove-admin-menu.php
Created June 26, 2014 14:39
Remove WooCommerce Admin Menu for everyone except Administrators
<?php
/**
* Remove the WooCommerce admin menu for everyone except WordPress Administrators
*
*/
add_action( 'admin_menu', 'remove_menus' );
function remove_menus(){
// If the current user is not an admin
@patrickgilmour
patrickgilmour / wp_get_nav_menu_object_name.php
Created June 22, 2014 20:52
[WordPress] Retrieve and show the name of a WordPress menu using #wp_get_nav_menu_object
/**
* Get the name of a WordPress menu using wp_get_nav_menu_object'
*
*/
add_filter( 'the_content' , 'pg_show_nav_menu_title' );
function pg_show_nav_menu_title ( $content ) {
// ID of the menu you want
$nav_menu_id = 13;
@patrickgilmour
patrickgilmour / wp_remove_capabilities.php
Created June 20, 2014 00:03
[WordPress] Remove custom capabilities in WordPress and Roles
/**
* Remove WordPress Capabilities
*
*/
add_action( 'admin_init', 'pgwp_clean_unwanted_caps' );
function pgwp_clean_unwanted_caps(){
$delete_caps = array('edit_issues', 'publish_issues', 'edit_other_issues', 'read_private_issues', 'delete_issue', 'edit_issue');
global $wp_roles;
@patrickgilmour
patrickgilmour / css_resources.md
Created June 19, 2014 14:39 — forked from jookyboi/css_resources.md
CSS libraries and guides to bring some order to the chaos.

Libraries

  • 960 Grid System - An effort to streamline web development workflow by providing commonly used dimensions, based on a width of 960 pixels. There are two variants: 12 and 16 columns, which can be used separately or in tandem.
  • Compass - Open source CSS Authoring Framework.
  • Bootstrap - Sleek, intuitive, and powerful mobile first front-end framework for faster and easier web development.
  • Font Awesome - The iconic font designed for Bootstrap.
  • Zurb Foundation - Framework for writing responsive web sites.
  • SASS - CSS extension language which allows variables, mixins and rules nesting.
  • Skeleton - Boilerplate for responsive, mobile-friendly development.

Guides

@patrickgilmour
patrickgilmour / javascript_resources.md
Created June 19, 2014 14:39 — forked from jookyboi/javascript_resources.md
Here are a set of libraries, plugins and guides which may be useful to your Javascript coding.

Libraries

  • jQuery - The de-facto library for the modern age. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers.
  • Backbone - Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
  • AngularJS - Conventions based MVC framework for HTML5 apps.
  • Underscore - Underscore is a utility-belt library for JavaScript that provides a lot of the functional programming support that you would expect in Prototype.js (or Ruby), but without extending any of the built-in JavaScript objects.
  • lawnchair - Key/value store adapter for indexdb, localStorage
@patrickgilmour
patrickgilmour / 0_reuse_code.js
Created June 19, 2014 14:38
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