Skip to content

Instantly share code, notes, and snippets.

Travis Northcutt tnorthcutt

Block or report user

Report or block tnorthcutt

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am tnorthcutt on github.
  • I am tnorthcutt (https://keybase.io/tnorthcutt) on keybase.
  • I have a public key whose fingerprint is BB70 0712 BEE1 724F 4790 F84F ACFD 9A82 F3EE 95F3

To claim this, I am signing this object:

View functions.php
<?php
// Nav Menu Dropdown Class
include_once( CHILD_DIR . '/lib/classes/nav-menu-dropdown.php' );
/**
* Mobile Menu
*
*/
function be_mobile_menu() {
@tnorthcutt
tnorthcutt / functions.php
Created Jan 30, 2013
Create a headline image with overlaid text on pages that have a featured image.
View functions.php
<?php
function ba_header_image() {
if ( !has_post_thumbnail() ) return; //don't do anything if there's no featured image
global $post;
$post_thumbnail_id = get_post_thumbnail_id();
$post_thumbnail_url = wp_get_attachment_image_src( $post_thumbnail_id, 'ba_header_image' );
@tnorthcutt
tnorthcutt / force-post-author.php
Created Mar 13, 2013
Force all posts to be assigned to a specific author on save
View force-post-author.php
<?php
add_action( 'save_post', 'ba_force_post_author' );
function ba_force_post_author( $post_id ) {
//verify post is not a revision
if ( !wp_is_post_revision( $post_id ) ) {
$mypost = array();
$my_post['post_author'] = 2, //The user ID number of the author.
$my_post['ID'] = $post_id;
wp_update_post( $my_post );
}
@tnorthcutt
tnorthcutt / pinboard-search-popup.js
Created Mar 14, 2013
Quick pinboard bookmarking in Chrome
View pinboard-search-popup.js
/*
*In Chrome, add a new search engine (Settings -> Search -> Manage Search Engines), with 'p' as the keyword,
* and the following snippet in the url field. To use, press cmd/ctrl+l, type 'p', then enter. You should see a
* new window where you can save the bookmark in pinboard. Enjoy!
*/
javascript:q=location.href;if(document.getSelection)%7Bd=document.getSelection();%7Delse%7Bd='';%7D;p=document.title;void(open('https://pinboard.in/add?url='+encodeURIComponent(q)+'&description='+encodeURIComponent(d)+'&title='+encodeURIComponent(p),'Pinboard','toolbar=no,width=700,height=350'));
@tnorthcutt
tnorthcutt / fix.css
Created May 22, 2013
ManageWP stylesheet tweak
View fix.css
@media only screen and (max-width:767px){.container{width:300px;}#single{width: 100%}
@tnorthcutt
tnorthcutt / functions.php
Created May 28, 2013
Short-circuit genesis_get_option to set Genesis options for a specific situation.
View functions.php
<?php
// These are just two examples
// Uses anonymous functions since these are for one-time use
// Short-circuit genesis_get_option to show thumbnails
add_filter( 'genesis_pre_get_option_content_archive_thumbnail', function() {
return 1; // 1 shows thumbnails
} );
@tnorthcutt
tnorthcutt / archive-leader.php
Created May 28, 2013
Subtitles for CPT archive issue
View archive-leader.php
<?php
add_action( 'genesis_after_entry_content', 'genesis_do_post_title', 20 );
add_action( 'genesis_after_entry_content', 'ehr_do_post_subtitle', 21 );
genesis();
@tnorthcutt
tnorthcutt / functions.php
Created May 31, 2013
Allow extra tags in content on archive pages
View functions.php
<?php
add_filter( 'get_the_content_limit_allowedtags', 'ehr_content_limit_allowed_tags' );
function ehr_content_limit_allowed_tags($tags) {
$tags .= '<a>';
return $tags;
}
View cmb-canned-responses.md

CMB2 Canned Issue Response

Unfortunately, we can't support every person's specific or custom implementations for CMB2. Github issues are reserved for confirmed bug reports and occasional feature requests. Please review the CONTRIBUTING.md for support suggestions. Please also review the additional resources listed at the bottom of that document, as the solution you're looking for may already be present.

CMB2 Taxonomy field canned response

The taxonomy fields are not intended to provide an arbitrary list of terms to pick from, but are intended to be a replacement for the default taxonomy metaboxes. I.e. they are meant to set the taxonomy terms on an object. Any other use of these types will be hacky and/or buggy. I suggest looking at building a custom field type for this: https://github.com/WebDevStudios/CMB2/wiki/Tips-&-Tricks#a-dropdown-for-taxonomy-terms-which-does-not-set-the-term-on-the-post

CMB2 wrong PR response

Thank you for

You can’t perform that action at this time.