Skip to content

Instantly share code, notes, and snippets.

View wpsmith's full-sized avatar

Travis Smith wpsmith

View GitHub Profile
@wpsmith
wpsmith / wps_cpt_admin_enqueue_scripts.php
Last active November 11, 2016 22:08
PHP: Disable initial autosave/autodraft
<?php
add_action( 'admin_enqueue_scripts', 'wps_cpt_admin_enqueue_scripts' );
/**
* Disable initial autosave/autodraft
*/
function wps_cpt_admin_enqueue_scripts() {
if ( 'cpt' == get_post_type() )
wp_dequeue_script( 'autosave' );
}
@wpsmith
wpsmith / wps_dropdown_pages_args_add_parents.php
Created January 3, 2013 16:17
Add private/draft/future/pending pages to parent dropdown in page attributes and Quick Edit
<?php
add_filter( 'page_attributes_dropdown_pages_args', 'wps_dropdown_pages_args_add_parents' );
add_filter( 'quick_edit_dropdown_pages_args', 'wps_dropdown_pages_args_add_parents' );
/**
* Add private/draft/future/pending pages to parent dropdown.
*/
function wps_dropdown_pages_args_add_parents( $dropdown_args, $post = NULL ) {
$dropdown_args['post_status'] = array( 'publish', 'draft', 'pending', 'future', 'private', );
return $dropdown_args;
@wpsmith
wpsmith / plugin.php
Last active December 10, 2015 15:38
Genesis Tabs Alternative
<?php
/*
Plugin Name: Genesis Tabs Alternative
Plugin URI: http://www.studiopress.com/plugins/genesis-tabs
Description: Genesis Simple Tabs extends the Featured Post widget to create a simple tabbed area.
Author: StudioPress, wpsmith
Author URI: http://www.studiopress.com
Version: 1.0.0
<?php
/*
Plugin Name: Unplugged Mobile Theme
Plugin URI: http://www.rachelbaker.me
Description: A plugin and theme for WordPress that automatically reformats your blog's content for optimized viewing on Apple's <a href="http://www.apple.com/unplugged/">unplugged</a> and <a href="http://www.apple.com/ipodtouch/">iPod touch</a>.
Author: Rachel Baker
Version: 0.1
Author URI: http://www.rachelbaker.me
# Special thanks to Imthiaz Rafiq and the wp-pda Plugin (http://imthi.com/wp-pda/) which this plugin is derived from.
add_action( 'genesis_loop', 'cd_custom_taxonomy_archives' );
/**
* Output the taxonomy name and an associated taxonomy image
*/
function cd_custom_taxonomy_archives() {
//print the page title
the_title('<h1 class="entry-title">', '</h1>');
// Code sample modified from example on http://wordpress.mfields.org/plugins/taxonomy-images/
@wpsmith
wpsmith / gs_constants.php
Last active December 10, 2015 18:49
Create all necessary constants based on style.css
<?php
add_action( 'genesis_init', 'gs_constants', 15 );
/**
* This function defines the Genesis Child theme constants
*
* Data Constants: CHILD_SETTINGS_FIELD, CHILD_DOMAIN, CHILD_THEME_VERSION
* CHILD_THEME_NAME, CHILD_THEME_URL, CHILD_DEVELOPER, CHILD_DEVELOPER_URL
* Directories: CHILD_LIB_DIR, CHILD_IMAGES_DIR, CHILD_ADMIN_DIR, CHILD_JS_DIR, CHILD_CSS_DIR
* URLs: CHILD_LIB, CHILD_IMAGES, CHILD_ADMIN, CHILD_JS, CHILD_CSS
remove_action( 'genesis_header', 'genesis_header_markup_open', 5 );
add_action( 'genesis_header', 'child_header_markup_open', 5 );
/**
* Echo a clickable opening structural markup for the header.
*
* @since 1.2.0
*
* @uses genesis_structural_wrap() Maybe add opening .wrap div tag
*/
function child_header_markup_open() {
@wpsmith
wpsmith / wps_change_posts_per_page_in_grid.php
Last active December 10, 2015 20:38
Customizing the WordPress Query
<?php
add_action( 'pre_get_posts', 'wps_change_posts_per_page_in_grid' );
/**
* Change Posts Per Page
*
* @author Bill Erickson
* @author Travis Smith
* @link http://www.billerickson.net/customize-the-wordpress-query/
* @link http://wpsmith.net/2013/genesis/genesis-grid-loop-in-genesis-1-9/
@wpsmith
wpsmith / add_theme_support.php
Last active December 10, 2015 21:38
Add top navigation menu
<?php
add_theme_support( 'genesis-menus', array( __( 'primary' => 'Primary Navigation Menu', 'child' ) ) );
@wpsmith
wpsmith / wps_load_scripts.php
Created January 10, 2013 17:29
Enqueue Isotope
<?php
add_action( 'wp_enqueue_scripts', 'wps_load_scripts' );
/**
* Enqueue Isotope
* For commercially developed child themes, you must obtain a license
* from isotope.metafizzy.co for approx. $25.
*
* @author Travis Smith
* @link http://wpsmith.net