This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function get_html_attributes(s) { | |
var reg = /\s+([^\t\n\r\f \/>"'=]+)(?:\s*=\s*(['"])(.*?)\2)?/,attr = {}; | |
while ((result = reg.exec(s)) !== null) { | |
attr[result[1]] = result[3]; | |
s = s.replace(reg,''); | |
} | |
return attr; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function add_video_post_type() { | |
$labels = array( | |
'name' => _x( 'Videos', 'Post Type General Name', 'kibble' ), | |
'singular_name' => _x( 'Video', 'Post Type Singular Name', 'kibble' ), | |
'menu_name' => __( 'Videos', 'kibble' ), | |
'parent_item_colon' => __( 'Parent Item:', 'kibble' ), | |
'all_items' => __( 'All Items', 'kibble' ), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
viewRmTimesheet = function() { | |
var timesheet_link = $('.bonus-time'); | |
if (timesheet_link.length > 0) { | |
ks_dispatcher.go(timesheet_link.attr('href')); | |
} | |
} | |
if ( ks_dispatcher && ks_dispatcher.ks_managers && ks_dispatcher.ks_managers.length && ks_dispatcher.ks_managers[0] && ks_dispatcher.ks_managers[0].keys ) { | |
ks_dispatcher.ks_managers[0].keys.t = { | |
press: viewRmTimesheet.bind(this), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
# Prerequisite post type and meta fields for Recipe 3: Creating Post "Sections" | |
function recipe_3_prereq() { | |
register_post_type( 'wordcamp', array( | |
'public' => true, | |
'label' => 'WordCamps' | |
) ); | |
# See http://fieldmanager.org | |
if ( class_exists( 'Fieldmanager_Field' ) ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Get terms from one taxonomy that relate to terms from another taxonomy through published posts. | |
* For instance, get all tags that are set on posts in the category "WordPress". | |
* | |
* @param array $args An array of options. Must contain at least 'term_ids' OR 'term_names'. Options are: | |
* string 'get_taxonomy' => the taxonomy whose terms you want to retrieve. Default is post_tag | |
* string 'through_taxonomy' => the taxonomy whose term(s) you're providing. Default is category | |
* array 'term_ids' => an array of term IDs through which to find overlapping terms |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<!--[if IE 6]> | |
<html id="ie6" lang="en-US"> | |
<![endif]--> | |
<!--[if IE 7]> | |
<html id="ie7" lang="en-US"> | |
<![endif]--> | |
<!--[if IE 8]> | |
<html id="ie8" lang="en-US"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Cycle/alternate unlimited values of a given array. | |
* | |
* For instance, if you call this function five times with | |
* `wp_cycle( 'three', 'two', 'one' )`, you will in return get: three two one | |
* three two. This is useful for loops and allows you to do things like cycle | |
* HTML classes. | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
c_purp=`tput setaf 4` | |
c_red=`tput setaf 1` | |
c_green=`tput setaf 2` | |
c_sgr0=`tput sgr0` | |
parse_git_branch () | |
{ | |
if git rev-parse --git-dir >/dev/null 2>&1 | |
then | |
gitver=$(git branch 2>/dev/null| sed -n '/^\*/s/^\* //p') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Customize TinyMCE -- Add styles dropdown and add some custom styles. Selecting the style will add a class to the element. | |
* | |
**/ | |
function my_tinymce_styles( $init ) { | |
$init['theme_advanced_buttons2_add_before'] = 'styleselect'; | |
$init['theme_advanced_styles'] = 'Top Right Inset=insettop,Left Inset=insetleft,Right Inset=insetright'; | |
return $init; |