Skip to content

Instantly share code, notes, and snippets.

@jamiemitchell
jamiemitchell / functions.php
Created May 5, 2013 03:51
Remove post info/meta on products category pages
<?php
/* Remove post info/meta on products category pages
------------------------------------------------------------ */
add_action('genesis_before','remove_post_info_meta');
function remove_post_info_meta() {
if ( in_category('products')) {
<?php
add_action( 'genesis_before_loop', 'child_maybe_do_grid_loop' );
function child_maybe_do_grid_loop() {
// Amend this conditional to pick where this grid looping occurs
if ( is_page('2') ) {
remove_action('genesis_before_post_content', 'genesis_post_info');
@jamiemitchell
jamiemitchell / archive-testimonials.php
Created May 22, 2013 03:37 — forked from cdils/archive-testimonials.php
Needs updating to Genesis 2.0
<?php
/**
* Template Name: Testimonial Archives
* Description: Used as a page template to show page contents, followed by a loop through a CPT archive
*/
remove_action ('genesis_loop', 'genesis_do_loop'); // Remove the standard loop
add_action( 'genesis_loop', 'custom_do_loop' ); // Add custom loop
/**
* Auto-generate taxonomy title for archive pages
*
* Will say "[Term] Archives"
*
*/
add_action( 'genesis_before_loop', 'ac_do_taxonomy_title_description', 20 );
function ac_do_taxonomy_title_description() {
@jamiemitchell
jamiemitchell / taxonomy-product_category.php
Created May 27, 2013 00:58
I have a CPT of "product" With a custom taxonomy of "product_category". By taking advantage of the WordPress template structure, using taxonomy-product_category.php takes priority. Remove the default loop. Build a custom loop that needs to perform exactly as the original loop, but being a custom loop, i now have control of what else goes in it, …
<?php
remove_action ('genesis_loop', 'genesis_do_loop');
add_action( 'genesis_loop', 'jm_custom_do_loop' );
function jm_custom_do_loop() {
$args = array(
'post_type' => 'product',
'order_by' => 'title',
@jamiemitchell
jamiemitchell / custom-post-types.php
Created May 27, 2013 01:00
Custom post type with custom taxonomy
<?php
/**
* Creating the product listing custom post type
*/
function product_listing() {
$labels = array(
'name' => __('Products', 'post type general name'),
'singular_name' => __('Product', 'post type singular name'),
'add_new' => _x('Add New', 'Product'),
@jamiemitchell
jamiemitchell / style.css
Created May 28, 2013 23:58
Center the simple social icons for mobile devices, this needs to go in your media queries (portrait) of your style.css
/* Center simple social icons
-------------------------------------------- */
body .simple-social-icons .alignleft,
body .simple-social-icons .alignright {
float: none;
text-align: center;
}
<?php
/**
* Customize Product Category Query
* @link http://www.billerickson.net/customize-the-wordpress-query/
*/
function be_product_category_query( $query ) {
if( $query->is_main_query() && !is_admin() && $query->is_tax( 'product-category' ) ) {
$query->set( 'orderby', 'title' );
function staff_do_grid_loop() {
$args = array(
'post_type' => 'page',
'meta_key' => 'staff',
'posts_per_page'=> 4,
'orderby' => 'menu_order',
'order' => 'ASC',
'paged' => get_query_var( 'paged' ),
);
@jamiemitchell
jamiemitchell / custom-post-types.php
Created June 17, 2013 06:12
Custom post type and taxonomy example.
<?php
/* Creating the product listing custom post type
------------------------------------------------------------ */
function product_listing() {
$labels = array(
'name' => __('Products', 'post type general name'),
'singular_name' => __('Product', 'post type singular name'),
'add_new' => _x('Add New', 'Product'),