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
var a = $('#navbar-31536'); // container element | |
var b = $('ul.nav.navbar-nav li a').height(); // height of the menu | |
function UsmDynamicCollapse(a, b) { | |
var navbar = a; | |
var height = b; | |
navbar.removeClass('collapsed'); // set standart view | |
if(navbar.innerHeight() > height ) // check if we've got 2 lines | |
navbar.addClass('collapsed'); // force collapse mode | |
} |
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 print_p($value = false, $exit = false, $return=false, $recurse=false) { | |
if ($return === true && $exit === true) | |
$return = false; | |
$tab = str_repeat(" ", 8); | |
if ($recurse == false) { | |
$recurse = 0; | |
$output = '<a class="btn btn-primary" type="button" data-toggle="collapse" data-target="#debugInfo" aria-expanded="false"> | |
Debug Info | |
</a><pre id="debugInfo" class="collapse" style="width:100%; height:1px; border: 1px dotted #ccc; background-color: #eee; display: block; padding: 20px;">'; | |
$backtrace = debug_backtrace(); |
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 ID by Page Slug | |
* | |
* You'll often need to get content for a specific post object and render it somewhere else. We want to avoid | |
* using hard-coded ID's because we need to maintain portability of our work. This function aids that process without | |
* introducing too much overhead. In fact, it's arguably easier to develop this way. Further, its more efficient | |
* computationally. | |
* | |
* BACKGROUND: |
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 | |
add_action( 'after_setup_theme', 'usm_custom_post_types' ); | |
function usm_custom_post_types() { | |
if ( ! class_exists( 'Super_Custom_Post_Type' ) ) | |
return; | |
$team = new Super_Custom_Post_Type( 'team', 'Team Member', 'Team Members' ); | |
$team->set_icon( 'group' ); | |
$team->add_meta_box( array( |
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
add_action( 'after_setup_theme', 'cb_custom_post_types' ); | |
function cb_custom_post_types() { | |
if ( ! class_exists( 'Super_Custom_Post_Type' ) ) | |
return; | |
$team = new Super_Custom_Post_Type( 'team', 'Team Member', 'Team Members' ); | |
$team->set_icon( 'group' ); | |
$team->add_meta_box( array( | |
'id' => 'hr-details', |
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 | |
add_action( 'after_setup_theme', 'cb_data_model' ); | |
function cb_data_model() { | |
if ( ! class_exists( 'Super_Custom_Post_Type' ) ) | |
return; | |
## TESTIMONIALS MODEL | |
$testimonials = new Super_Custom_Post_Type( 'testimonial', 'Testimonial', 'Testimonials' ); | |
$testimonials->set_icon( 'comment' ); |
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 | |
/** | |
* Simple function to streamline using image assets in your theme | |
* | |
* @author Darin Cassler | |
* @uses Wordpress | |
* @param string $src Required. The name of your image asset | |
* @param string $alt Optional. The alternate next for your img tag, if left blank - will use the image name. | |
* @param string $path Optional. This is the path inside your theme where images are stored. Defaults to /img/. | |
* @var $alt - Alt text for your image |
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
/** | |
* Filters posts by last word in title | |
* | |
* Particularly useful for sorting staff lists by last name alphabetically | |
**/ | |
function posts_orderby_lastname ($orderby_statement) { | |
$orderby_statement = "RIGHT(post_title, LOCATE(' ', REVERSE(post_title)) - 1) ASC"; | |
return $orderby_statement; | |
} |
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 order_events_by_date($request){ | |
$dummy_query = new WP_Query(); | |
$dummy_query->parse_query( $request ); | |
if($dummy_query->is_singular()): | |
return $request; | |
elseif(isset($request['post_type']) && $request['post_type'] == 'event'): | |
if(!is_admin()): | |
$request['orderby'] = 'meta_value_num menu_order title'; | |
$request['meta_key'] = array(array('event-date'),array('event-time')); |
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
/** | |
* Type the following commands into terminal and start a new session | |
* this will fix any issues with Xcode not being able to git-pull in iTerm + ZSH | |
**/ | |
cd /Applications/iTerm.app/Contents/MacOS | |
mv iTerm iTerm-bin | |
cat > iTerm <<EOF | |
#!/bin/sh |