Skip to content

Instantly share code, notes, and snippets.

Travis Smith wpsmith

Block or report user

Report or block wpsmith

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
@wpsmith
wpsmith / nothing.php
Created Feb 15, 2012
Trying to add "last-post" class to the loop
View nothing.php
$post_classes = get_post_class();
$odd_or_even = 'even';
$post_counter = 0;
$post_counter++;
$odd_or_even = ( 'odd' == $odd_or_even ) ? 'even' : 'odd';
$post_classes[] = ( $post_counter == count( $posts ) ) ? 'last-post' :$odd_or_even;
echo '<div class="' . implode( ' ', $post_classes ) . '">';
@wpsmith
wpsmith / radio-latest-news-widget.php
Created Feb 15, 2012 — forked from gregrickaby/radio-latest-news-widget.php
If there's no content, don't display [Continue...]
View radio-latest-news-widget.php
if ( ! empty( $instance['show_content'] ) ) {
if ( 'excerpt' == $instance['show_content'] )
the_excerpt();
elseif ( 'content-limit' == $instance['show_content'] && strip_shortcodes( get_the_content() ) != '' )
the_content_limit( (int) $instance['content_limit'], esc_html( $instance['more_text'] ) );
else
the_content( esc_html( $instance['more_text'] ) );
}
@wpsmith
wpsmith / global.js
Created Jun 29, 2012 — forked from jaredatch/global.js
Mobile Genesis menus
View global.js
jQuery(document).ready(function($){
// Mobile navigation
$('#prim-selector, #sec-selector').change(function(){
if ($(this).val()!='') {
window.location.href=$(this).val();
}
});
});
@wpsmith
wpsmith / functions.php
Created Aug 18, 2012 — forked from billerickson/functions.php
Add "Email Us" link to footer
View functions.php
<?php
/**
* Add "Email Us" link to footer
*
* @author Bill Erickson
* @author Travis Smith (modified)
* @link http://www.billerickson.net/overriding-options-and-meta
*/
function be_email_us() {
@wpsmith
wpsmith / gist:3875217
Created Oct 11, 2012 — forked from pdewouters/gist:3875212
disable wysiwyg on specific page ID
View gist:3875217
add_action( 'admin_init', 'wps_hide_editor' );
/**
* Remove the editor for a specific post.
*
* @return null Returns early for non-admin and other admin pages.
*/
function wps_hide_editor() {
$post_id = isset( $_GET['post'] ) ? $_GET['post'] : $_POST['post_ID'] ;
if( ! isset( $post_id ) || ! is_admin() ) return;
View build.default.properties
phpcs.standard = WordPress
phpcs.tabWidth = 4
phpcs.encoding = utf-8
ftp.host = ftp.example.com
ftp.port = 21
ftp.username = username
ftp.password = password
ftp.project.dir = /subdomains/docs/httpdocs/${project.name.safe}
ftp.dir = ${ftp.project.dir}/${project.version}
@wpsmith
wpsmith / gist:4002176
Created Nov 2, 2012 — forked from billerickson/gist:2578637
CSS: Width including padding
View gist:4002176
-webkit-box-sizing: border-box; /* Safari/Chrome, other WebKit */
-moz-box-sizing: border-box; /* Firefox, other Gecko */
box-sizing: border-box; /* Opera/IE 8+ */
@wpsmith
wpsmith / wp_private_page_filters.php
Created Dec 4, 2012 — forked from sillybean/wp_private_page_filters.php
Private page filters for WordPress. Related to ticket #8592.
View wp_private_page_filters.php
/**
* Add private/draft/future/pending pages to parent dropdown in page attributes metabox and Quick Edit
*
* @param array $dropdown_args
* @param object $post (Optional)
* @return array $dropdown_args
*/
function page_attributes_metabox_add_parents( $dropdown_args, $post = NULL ) {
$dropdown_args['post_status'] = array('publish', 'draft', 'pending', 'future', 'private');
return $dropdown_args;
@wpsmith
wpsmith / functions.php
Created Dec 6, 2012 — forked from GaryJones/functions.php
Genesis Grid Loop Advanced
View functions.php
<?php
/**
* Possibly amend the loop.
*
* Specify the conditions under which the grid loop should be used.
*
* @author Bill Erickson
* @author Gary Jones
* @link http://code.garyjones.co.uk/genesis-grid-loop-advanced/
View functions.php
add_action( 'wp_enqueue_scripts', 'child_load_google_font' );
/**
* Enqueue Google Font
*
* @author Greg Rickaby
* @since 1.0
*/
function child_load_google_font() {
$protocol = is_ssl() ? 'https' : 'http';
You can’t perform that action at this time.