Skip to content

Instantly share code, notes, and snippets.

View patrickodacre's full-sized avatar

Patrick O'Dacre patrickodacre

View GitHub Profile
@patrickodacre
patrickodacre / 0_reuse_code.js
Created April 14, 2014 20:37
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
# -----------------------------------------------------------------
# .gitignore for WordPress @salcode
# ver 20150227
#
# From the root of your project run
# curl -O https://gist.githubusercontent.com/salcode/b515f520d3f8207ecd04/raw/.gitignore
# to download this file
#
# By default all files are ignored. You'll need to whitelist
# any mu-plugins, plugins, or themes you want to include in the repo.
@patrickodacre
patrickodacre / bower.json
Created July 10, 2015 14:21
heisenberg - Zeek Interactive Starter Theme
{
"name": "heisenberg",
"version": "0.0.1",
"authors": [
"Jacob Arriola <jacob@zeek.com>",
"Steve Zehngut <steve@zeek.com>",
"David Arceneaux <david@zeek.com>"
],
"description": "WordPress starter theme",
"keywords": [
add_action('wp_loaded','webendev_register_nav_menu_class');
/**
* New walker class to extend Walker_Nav_Menu
* Dynamically adds child categories to menu
*
*/
function webendev_register_nav_menu_class(){
class Submenu_Walker_Nav_Menu extends Walker_Nav_Menu {
1. call_user_func_array passes the callback function an array of parameters.
2. $args = func_get_args();
2a.
array (size=3)
0 => string 'This is Episode Number' (length=22)
1 => int 4
2 =>
@patrickodacre
patrickodacre / know_the_code_show_pt_2_ep_5
Created July 22, 2015 17:13
Know the Code Show - Part 2, Ep 5
1.
array (size=2)
'function' => string '_config_wp_siteurl' (length=18)
'accepted_args' => int 1
@patrickodacre
patrickodacre / know_the_code_show_pt_2_ep_5
Created July 22, 2015 17:13
Know the Code Show - Part 2, Ep 5
1.
array (size=2)
'function' => string '_config_wp_siteurl' (length=18)
'accepted_args' => int 1
1.
array (size=2)
'function' => string '_config_wp_siteurl' (length=18)
'accepted_args' => int 1
2. a - an array comprising the argument list / the variables - as declared at the time of creating the filter. A dev can declare as many variables as he wants.
b. $arg stores the arguments / the variables declared when a developer uses the apply_filters function. It has to store the arguments assigned to that $tag.
Code Challenge 1
@patrickodacre
patrickodacre / helpers.php
Last active June 16, 2016 15:08
Register custom widget areas using a config file.
<?php namespace PrefixCore\Support;
/**
* Load the specified config file.
*
* @since 1.0.0
*
* @param string $config_file Config filename with extension.
* @param string $path Config path. Defaults to plugin config folder.
* @returns array Returns the configuration array.
@patrickodacre
patrickodacre / admin.php
Last active October 1, 2016 22:56
Create CMB2 Metaboxes and Fields
<?php namespace PrefixCore\Admin;
/**
* Add metabox and fields to a theme options page.
*
* Replace the add_options_page_metabox method with what you see below.
* Obviously, you'll want to update the namespace, constant and config path
* to suit your situation.
*
* @link https://github.com/WebDevStudios/CMB2-Snippet-Library/blob/master/options-and-settings-pages/theme-options-cmb.php