Skip to content

Instantly share code, notes, and snippets.

View wpsmith's full-sized avatar

Travis Smith wpsmith

View GitHub Profile
@wpsmith
wpsmith / genesis_site_layout.php
Last active February 9, 2022 14:40
Force Specific Layout on a page
/**** Truly Force Layout without allowing the User to Override the preferred/recommended layout ****/
// Force Full Width Layout
add_filter( 'genesis_site_layout', '__genesis_return_full_width_content' );
// Force Content-Sidebar Layout
add_filter( 'genesis_site_layout', '__genesis_return_content_sidebar' );
// Force Sidebar-Content Layout
add_filter( 'genesis_site_layout', '__genesis_return_sidebar_content' );
@wpsmith
wpsmith / gbootstrap-hide-mb.js
Created September 7, 2012 19:03
Hides meta box based on page template selected.
/*
* Meta Box Admin Script
*
* @author Travis Smith
* @version 1.0.0
*/
/*
* Hides meta box based on page template selected.
*
@wpsmith
wpsmith / wps_soliloquy_dates.php
Created September 7, 2012 22:27
Soliloquy: Make Images Have Start and End Dates
<?php
/*
Plugin Name: Soliloquy Start/Expiration Addon
Plugin URI: http://wpsmith.net/
Description: Soliloquy is the best responsive jQuery slider plugin for WordPress. This makes it better by adding start/expiration dates.
Author: Travis Smith
Author URI: http://wpsmith.net/
Version: 1.0.0
License: GNU General Public License v2.0 or later
@wpsmith
wpsmith / debug.php
Created September 11, 2012 15:15
Debugging WP_Query
<?php
add_action( 'template_redirect', 'wps_debug' );
function wps_debug() {
global $wp_query;
if( isset( $_GET['debug'] ) ) {
echo '<pre>'; print_r( $wp_query ); echo '</pre>';
}
}
@wpsmith
wpsmith / promotions.php
Created September 12, 2012 20:17
Promotions API for Shopp
<?php
/**
* Promotions API
*
* Plugin api for manipulating promotions.
*
* @author Travis Smith
* @version 1.0
* @copyright Ingenesis Limited, June 30, 2011
@wpsmith
wpsmith / visual-subtitle.php
Created September 14, 2012 16:29
Visual Subtitle plugin
<?php
/**
* Visual Subtitle plugin
*
* Allows part of a post title to be styled as a subtitle. The subtitle is still
* within the title level 1 or 2 heading, but is wrapped in a span to be styled
* differently.
*
* @package Visual Subtitle
* @author Gary Jones
@wpsmith
wpsmith / visual-subtitle.php
Created September 17, 2012 21:08
How to split out Visual Subtitle into its own Genesis Hook (genesis_after_post_title)
<?php
// Remove Visual_Subtitle filter
remove_filter( 'the_title', array( Visual_Subtitle::$instance, 'filter' ) );
add_action( 'genesis_after_post_title', 'wps_subtitle' );
/**
* Adds the subtitle to genesis_after_post_title.
* No need to rebuild admin portion since WP doesn't recognize it anyways.
*/
function wps_subtitle() {
@wpsmith
wpsmith / flexslider-additional.css
Created September 19, 2012 16:43
Adds Thumbnails to Soliloquy Slider
.soliloquy-container .flex-control-thumbs {
margin: 5px 0 0;
position: static;
}
.soliloquy-container .flex-control-thumbs li {
width: 25%;
float: left;
list-style-type: none;
margin: 0;
}
@wpsmith
wpsmith / wps_get_image_lazy.php
Created October 5, 2012 18:33
Add Lazy Load to Genesis Get Image
add_filter( 'lazyload_images_placeholder_image', 'wps_lazyload_placeholder_image' );
/**
* Filter the default image src/URL.
*
* @param $image string Default Image URL/src.
* @return string New default Image URL/src.
*/
function wps_lazyload_placeholder_image( $image ) {
return 'http://url/to/image';
}
@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;