Skip to content

Instantly share code, notes, and snippets.

@jaredatch
jaredatch / gist:3759896
Created September 21, 2012 05:37 — forked from billerickson/gist:3698476
WP: Query $args
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query
* Source: http://core.trac.wordpress.org/browser/tags/3.3.1/wp-includes/query.php
*/
$args = array(
@jaredatch
jaredatch / functions.php
Created September 21, 2012 05:52 — forked from billerickson/functions.php
Add Custom Image Sizes to Media Uploader
<?php
/**
* Add Custom Image Sizes to Media Uploader
* @author Pippin Williamson
* @link http://pippinsplugins.com/add-custom-image-sizes-to-media-uploader/
*
* @param array $sizes
* @return array
*/
@jaredatch
jaredatch / gist:3764381
Last active October 10, 2015 22:58
Customize image size used in the loop by Genesis
<?php
/**
* Customize image size used in the loop by Genesis
*
* @author Jared Atchison
* @link http://jaredatchison.com/code/
* @param string $image_size
* @global array $wp_query
* @global int $loop_counter
* @return string
@jaredatch
jaredatch / gist:3764391
Last active November 8, 2019 09:48
Redirect taxonomy to use archive template
<?php
/**
* Redirect taxonomy to use custom post type archive template
*
* @author Jared Atchison
* @link http://jaredatchison.com/code/
* @param string $template
* @return string
*/
function ja_template_redirect( $template ) {
@jaredatch
jaredatch / gist:3764446
Last active October 10, 2015 22:58
Add taxonomy slugs to post class
<?php
/**
* Add taxonomy slugs to post class
*
* @author Jared Atchison
* @link http://jaredatchison.com/code/
* @param array $classes
* @global array $post
* @return array
*/
@jaredatch
jaredatch / gist:3764489
Last active October 10, 2015 22:58
Change post title placeholder text for custom post type
<?php
/**
* Change post title placeholder text for custom post type
*
* @author Jared Atchison
* @link http://jaredatchison.com/code/
* @global array $post
* @param string $translation
* @return string Customized string for title
*/
@jaredatch
jaredatch / gist:3764510
Last active October 10, 2015 22:58
Detect gist shortcode in post content
<?php
/**
* Detect gist shortcode in post content
*
* This assumes you are using a shortcode in the format [gist id="xxxxx'].
* I use this code in a custom metabox that is registered for my code snippets
* custom post type. This way after I save the snippet (or when editting an
* existing snippet) it will show the snippet below the post editor in a
* metabox.
*
@jaredatch
jaredatch / gist:3764519
Created September 21, 2012 23:36
Conditional checks for subpages
<?php
/**
* Checks for sub pages
*
* This see if the current page is the page, or is a sub page
* of the page
*
* @since 1.0.0
* @link http://codex.wordpress.org/Conditional_Tags#Testing_for_sub-Pages
* @param int $pid, post id
@jaredatch
jaredatch / gist:3829628
Created October 3, 2012 20:26
Suppress debug info to Debug Bar only
<?php
/**
* Suppress debug warnings and notices to the debug bar.
* Place the follow lines in your wp-config.
*
* Install the Debug Bar - http://wordpress.org/extend/plugins/debug-bar/
*
* Other recommended Debug Bar add-ons:
* http://wordpress.org/extend/plugins/debug-bar-cron/
* http://wordpress.org/extend/plugins/tdd-debug-bar-post-meta/
@jaredatch
jaredatch / gist:3868274
Created October 10, 2012 20:39
bbPress Members Only
<?php
/**
* Plugin Name: bbPress Members Only
* Plugin URI: http://wordpress.org/extend/plugins/bbpress-members-only/
* Description: This plugin is retricts bbPress to logged in/registered members.
* Version: 1.0
* Author: Jared Atchison
* Author URI: http://jaredatchison.com
*
* This program is free software; you can redistribute it and/or modify