Skip to content

Instantly share code, notes, and snippets.

View clinton-warren's full-sized avatar

clinton-warren

View GitHub Profile
@clinton-warren
clinton-warren / gist:4557389
Created January 17, 2013 16:41
Wordpress child theme
/*
Theme Name: Doover Child
Description: Child theme for the Doover theme
Author: Techcare LLC
Template: doover
*/
@import url("../doover/style.css");
@clinton-warren
clinton-warren / gist:4355468
Last active December 10, 2015 00:59
WP_Query for Celia
<?php
$args = array (
'post_type' => 'books',
'showposts' => 3, // change this to how many books you want to show, set to -1 to display all that meet these criteria
'tax_query' => array(
'taxonomy' => 'genre',
'field' => 'slug',
'terms' => 'allbooks') //category slug
);
@clinton-warren
clinton-warren / gist:4072882
Created November 14, 2012 15:46
Output custom fields data
<?php $key="mykey"; echo get_post_meta($post->ID, $key, true); ?>
@clinton-warren
clinton-warren / gist:3933503
Created October 22, 2012 19:22
Wordpress Search Box
<form method="get" id="searchform" action="<?php bloginfo('home'); ?>/">
<div><input type="text" size="18" value="<?php echo wp_specialchars($s, 1); ?>" name="s" id="s" />
<input type="submit" id="searchsubmit" value="Search" class="btn" />
</div>
</form>
@clinton-warren
clinton-warren / CustomWidgetFile.php
Created October 17, 2012 18:10 — forked from jonathonbyrdziak/CustomWidgetFile.php
EMPTY WIDGET Plugin code to create a single widget in wordpress.
<?php
/**
* Duplicate this file as many times as you would like, just be sure to change the
* Empty_Widget class name to a custom name of your choice. Have fun! redrokk.com
*
* Plugin Name: Empty Widget
* Description: Single Widget Class handles all of the widget responsibility, all that you need to do is create the html. Just use Find/Replace on the Contact_RedRokk_Widget keyword to rebrand this class for your needs.
* Author: RedRokk Interactive Media
* Version: 1.0.0
* Author URI: http://www.redrokk.com
@clinton-warren
clinton-warren / wp-query-ref.php
Created October 17, 2012 18:07 — forked from luetkemj/wp-query-ref.php
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(
@clinton-warren
clinton-warren / gist:3907094
Created October 17, 2012 18:06
Hook to add category and taxonomy to custom post type
add_action('init', 'demo_add_default_boxes');
function demo_add_default_boxes() {
register_taxonomy_for_object_type('category', 'demo');
register_taxonomy_for_object_type('post_tag', 'demo');
}
@clinton-warren
clinton-warren / gist:3894266
Created October 15, 2012 18:40
Wordpress WP_Query Loop
<?php $custom_query = new WP_Query(array('post_type'=>'gallery','posts_per_page' => -1)); //
while($custom_query->have_posts()) : $custom_query->the_post(); ?>
<div <?php post_class(); ?> id="post-<?php the_ID(); ?>">
<h1><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h1>
<?php the_content(); ?>
<?php the_post_thumbnail();?>
</div>