Skip to content

Instantly share code, notes, and snippets.

@wpsmith
wpsmith / nothing.php
Created February 15, 2012 15:58
Trying to add "last-post" class to the loop
$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 February 15, 2012 18:47 — forked from gregrickaby/radio-latest-news-widget.php
If there's no content, don't display [Continue...]
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 June 29, 2012 04:20 — forked from jaredatch/global.js
Mobile Genesis menus
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 August 18, 2012 01:39 — forked from billerickson/functions.php
Add "Email Us" link to footer
<?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 October 11, 2012 20:19 — forked from pdewouters/gist:3875212
disable wysiwyg on specific page ID
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;
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 November 2, 2012 15:50 — forked from billerickson/gist:2578637
CSS: Width including padding
-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 December 4, 2012 13:06 — forked from stephanieleary/wp_private_page_filters.php
Private page filters for WordPress. Related to ticket #8592.
/**
* 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 December 6, 2012 19:54 — forked from GaryJones/functions.php
Genesis Grid Loop Advanced
<?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/
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';