Skip to content

Instantly share code, notes, and snippets.

View szbl's full-sized avatar

Sizeable, Inc. szbl

View GitHub Profile
<?php
/*
Plugin Name: List Children
Plugin Author: Andy Stratton
Plugin URI: http://theandystratton.com
Author URI: http://theandystratton@gmail.com
Version: 1.0
Description: Use an HTML comment (<code>&lt;!--list_children()--&gt;</code>) in post content to call wp_list_pages for sub-pages of the current page.
*/
<?php
/*
Plugin Name: Permalinker
Plugin Author: Andy Stratton
Plugin URI: http://theandystratton.com
Author URI: http://theandystratton@gmail.com
Version: 1.5
Description:
*/
<?php
/*
Plugin Name: Append Content
Description: Append content to your posts/pages, useful for repetitious messaging and calls to action. Apply template to all pages/posts, only to posts, or only to pages.
Version: 1.0
Author URI: http://theandystratton.com
Author: Andy Stratton <theandystratton@gmail.com>
*/
class APContent {
@szbl
szbl / holy-crap-help.txt
Created July 17, 2012 01:12
Pulling Shared Taxonomy Terms Based On Single Post Type
I have three custom post types that share a hierarchical custom taxonomy for Location. Root level terms are states, child terms are cities.
These post types are different types of "records" for this site's many "directories" if you will. I'd like to be able to share the taxonomy across all three but do the following with a core function/query/whatever:
Example page:
/post-type-1/states/
Description:
Shows a listing of all states (root-level terms) that have been assigned to a post with the type "post-type-1"
@szbl
szbl / get-terms-for-post-type.php
Created July 17, 2012 05:10
get_terms_for_post_type()
<?php
//
// Assumption: we have two post types, "books" and "videos" and a shared hierarchical taxonomy called "library-section"
//
/*
* Pulls all non-empty terms for a given post type.
*
* @param $taxonomy The name of the taxonomy, e.g. "library-section"
* @param $post_type The name of the post type, e.g. "book"
<!-- Highlighted Providers -->
<div id="content" class="clearfix">
<h1>Highlighted Providers</h1>
<ul class="hlprovide clearfix">
<?php
// Set the page to be pagination
$paged = get_query_var('paged') ? get_query_var('paged') : 1;
@szbl
szbl / table-markup.html
Created December 5, 2012 19:02
Example Table Markup
<table id="optional-unique-id" class="content-table">
<thead>
<tr>
<th>Heading 1</th>
<th>Heading 2</th>
<th>Heading 2</th>
</tr>
</thead>
<tbody>
<tr>
@szbl
szbl / szbl-wp-maintainer-env.php
Created December 9, 2012 18:01
Plugin for WP Maintainter client on 1and1 hosting with PHP5.4 strict standards notices
<?php
/*
Plugin Name: WP Maintainer 1and1 Server Fix
Author: theandystratton
Author URI: http://wpmaintainer.com
Description: Attempts to clean up some server environment issues with PHP to stop Strict Standards warnings from displaying in production.
*/
add_action( 'admin_init', 'wpm_admin_init' );
add_action( 'init', 'wpm_supress_public_errors' );
@szbl
szbl / szbl-add-page-revisions.php
Created December 10, 2012 22:28
Adds revisions to pages (should be there by default in screen options)
<?php
/*
Plugin Name: Add Page Revisions
Author: theandystratton
Author URI: http://sizeableinteractive.com
Description: Adds post type support for revisions to pages.
*/
add_action( 'init', 'szbl_add_page_revision_support' );
function szbl_add_page_revision_support()
{
<?php
function utm_welcome_redirect() {
// redirect anyone that is not logged in to /welcome
if ( !is_user_logged_in() )
{
wp_redirect( site_url( '/welcome' ), 303 );
die;
}
else