This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** Start the engine */ | |
require_once( get_template_directory() . '/lib/init.php' ); | |
/** Set Localization (do not remove) */ | |
load_child_theme_textdomain( 'minimum', apply_filters( 'child_theme_textdomain', get_stylesheet_directory() . '/languages', 'minimum' ) ); | |
/** Child theme (do not remove) */ | |
define( 'CHILD_THEME_NAME', __( 'Minimum Theme', 'minimum' ) ); | |
define( 'CHILD_THEME_URL', 'http://my.studiopress.com/themes/minimum' ); | |
/** Load Google fonts */ | |
add_action( 'wp_enqueue_scripts', 'minimum_load_google_fonts' ); | |
function minimum_load_google_fonts() { | |
wp_enqueue_style( | |
'google-fonts', | |
'http://fonts.googleapis.com/css?family=Open+Sans:400,700', | |
array(), | |
PARENT_THEME_VERSION | |
); | |
} | |
/** Sets Content Width */ | |
$content_width = apply_filters( 'content_width', 740, 740, 1140 ); | |
/** Add Viewport meta tag for mobile browsers */ | |
add_action( 'genesis_meta', 'minimum_add_viewport_meta_tag' ); | |
function minimum_add_viewport_meta_tag() { | |
echo '<meta name="viewport" content="width=device-width, initial-scale=1.0"/>'; | |
} | |
/** Add new image sizes */ | |
add_image_size( 'header', 1600, 9999, TRUE ); | |
add_image_size( 'portfolio', 330, 230, TRUE ); | |
/** Add support for custom background */ | |
add_theme_support( 'custom-background' ); | |
/** Add support for custom header */ | |
add_theme_support( 'genesis-custom-header', array( | |
'width' => 1140, | |
'height' => 100 | |
) ); | |
/** Remove Site Tag Line **/ | |
remove_action( 'genesis_site_description', 'genesis_seo_site_description' ); | |
/** Unregister layout settings */ | |
genesis_unregister_layout( 'content-sidebar-sidebar' ); | |
genesis_unregister_layout( 'sidebar-content-sidebar' ); | |
genesis_unregister_layout( 'sidebar-sidebar-content' ); | |
/** Unregister secondary sidebar */ | |
unregister_sidebar( 'sidebar-alt' ); | |
/** Add support for structural wraps */ | |
add_theme_support( 'genesis-structural-wraps', array( | |
'header', | |
'nav', | |
'subnav', | |
'inner', | |
'footer-widgets', | |
'footer' | |
) ); | |
/** Add the featured image section */ | |
add_action( 'genesis_after_header', 'minimum_featured_image' ); | |
function minimum_featured_image() { | |
if ( is_home() ) { | |
//echo '<div id="featured-image"><img src="'. get_stylesheet_directory_uri() . '/images/sample.jpg" /></div>'; | |
echo '<div id="home-featured"><div class="wrap">'; | |
genesis_widget_area( 'home-slider', array( 'before' => '<div class="home-slider widget-area">', ) ); | |
echo '</div></div>'; | |
} | |
elseif ( is_singular( array( 'post', 'page' ) ) && has_post_thumbnail() ){ | |
echo '<div id="featured-image">'; | |
echo get_the_post_thumbnail($thumbnail->ID, 'header'); | |
echo '</div>'; | |
} | |
} | |
add_action( 'init' , 'as247_remove_slider_styles' , 15 ); | |
function as247_remove_slider_styles() { | |
remove_action( 'wp_print_styles' , 'genesis_slider_styles' ); | |
} | |
/** Add additional style to site header */ | |
add_filter('genesis_seo_title', 'jj_site_title', 10, 3); | |
function jj_site_title($title) { | |
$title = '<h1 id="title"><a href="http://www.judyjensenstudio.com" title="Judy Jensen"><span>Judy</span>Jensen</a></h1>'; | |
return $title; | |
} | |
/** Register widget area */ | |
genesis_register_sidebar( array( | |
'id' => 'home-slider', | |
'name' => __( 'Home Slider', 'minimum' ), | |
'description' => __( 'This is the home slider', 'minimum' ), | |
) ); | |
/** Add the page title section*/ | |
add_action( 'genesis_after_header', 'minimum_page_title' ); | |
function minimum_page_title() { | |
require_once( get_stylesheet_directory() . '/page-title.php' ); | |
} | |
/** Customize the post info function*/ | |
add_filter( 'genesis_post_info', 'post_info_filter' ); | |
function post_info_filter( $post_info ) { | |
if ( !is_page() ) { | |
$post_info = __( 'Posted on', 'minimum' ) . ' [post_date] // [post_comments] [post_edit]'; | |
return $post_info; | |
}} | |
/** Customize the post meta function*/ | |
add_filter( 'genesis_post_meta', 'post_meta_filter' ); | |
function post_meta_filter( $post_meta ) { | |
if ( !is_page() ) { | |
//$post_meta = '[post_categories before="' . __( 'Filed Under: ', 'minimum' ) . '"] // [post_tags before="' . __( 'Tagged: ', 'minimum' ) . '"]'; | |
//return $post_meta; | |
}} | |
/** Modify the size of the Gravatar in the author box | |
add_filter( 'genesis_author_box_gravatar_size', 'minimum_author_box_gravatar_size' ); | |
function minimum_author_box_gravatar_size( $size ) { | |
return '96'; | |
}*/ | |
/** Add support for 3-column footer widgets */ | |
add_theme_support( 'genesis-footer-widgets', 3 ); | |
/** Add custom footer if widget area is used */ | |
add_action( 'genesis_footer', 'minimum_custom_footer', 6 ); | |
function minimum_custom_footer() { | |
if ( is_active_sidebar( 'custom-footer' ) ) { | |
remove_action( 'genesis_footer', 'genesis_do_footer' ); | |
echo '<div class="custom-footer">'; | |
dynamic_sidebar( 'custom-footer' ); | |
echo '</div><!-- end .custom-footer -->'; | |
} | |
} | |
/** | |
* Add custom taxonomies | |
* | |
* Additional custom taxonomies can be defined here | |
* http://codex.wordpress.org/Function_Reference/register_taxonomy | |
*/ | |
function add_custom_taxonomies() { | |
// Add new "Works" taxonomy to Posts | |
register_taxonomy('Works', 'portfolio', array( | |
// Hierarchical taxonomy (like categories) | |
'hierarchical' => true, | |
// This array of options controls the labels displayed in the WordPress Admin UI | |
'labels' => array( | |
'name' => _x( 'Works', 'taxonomy general name' ), | |
'singular_name' => _x( 'Work', 'taxonomy singular name' ), | |
'search_items' => __( 'Search Work' ), | |
'all_items' => __( 'All Work' ), | |
'parent_item' => __( 'Parent Work' ), | |
'parent_item_colon' => __( 'Parent Work:' ), | |
'edit_item' => __( 'Edit Work' ), | |
'update_item' => __( 'Update Work' ), | |
'add_new_item' => __( 'Add New Work' ), | |
'new_item_name' => __( 'New Work Name' ), | |
'menu_name' => __( 'Works' ), | |
), | |
// Control the slugs used for this taxonomy | |
'rewrite' => array( | |
'slug' => 'works', // This controls the base slug that will display before each term | |
'with_front' => false, // Don't display the category base before "/work/" | |
'hierarchical' => true // This will allow URL's like "/work/commissions/2013/" | |
), | |
)); | |
} | |
add_action( 'init', 'add_custom_taxonomies', 0 ); | |
/** | |
* Portfolio Body Class | |
* | |
* @param array $classes | |
* @return array | |
*/ | |
function be_portfolio_body_class( $classes ) { | |
$classes[] = 'portfolio-section'; | |
return $classes; | |
} | |
add_filter( 'body_class', 'be_portfolio_body_class' ); | |
/** | |
* Archive Post Class | |
* @since 1.0.0 | |
* | |
* Breaks the posts into three columns | |
* @link http://www.billerickson.net/code/grid-loop-using-post-class | |
* | |
* @param array $classes | |
* @return array | |
*/ | |
function be_archive_post_class( $classes ) { | |
if( is_tax( 'Works' ) || is_post_type_archive( 'portfolio' ) ) { | |
$classes[] = 'one-third'; | |
global $wp_query; | |
if( 0 == $wp_query->current_post || 0 == $wp_query->current_post % 3 ) | |
$classes[] = 'first'; | |
return $classes; | |
} | |
} | |
add_filter( 'post_class', 'be_archive_post_class' ); | |
add_filter( 'pre_get_posts', 'be_archive_query' ); | |
/** | |
* Archive Query | |
* | |
* Sets all archives to 27 per page | |
* @since 1.0.0 | |
* @link http://www.billerickson.net/customize-the-wordpress-query/ | |
* | |
* @param object $query | |
*/ | |
function be_archive_query( $query ) { | |
if( $query->is_main_query() && $query->is_archive() ) { | |
$query->set( 'posts_per_page', 9 ); | |
} | |
} | |
/** | |
* Sort Projects | |
* | |
*/ | |
function be_sort_projects() { | |
echo '<div class="sort-works">'; | |
echo '<ul>'; | |
// All Work | |
$class = is_post_type_archive( 'portfolio' ) ? 'all-projects active' : 'all-projects'; | |
echo '<li class="' . $class . '"><a href="' . get_post_type_archive_link( 'portfolio' ) . '">All Work</a></li>'; | |
// Project Types | |
$types = get_terms( 'Works', array( 'orderby' => 'menu_order' ) ); | |
foreach ( $types as $type ) { | |
$class = is_tax( 'type', $type->slug ) ? $type->slug . ' active' : $type->slug; | |
$class_name .= in_array("current_menu_item",$item->class) ? ' active' : ''; | |
echo '<li class="' . $class . '"><a href="' . get_term_link( $type, 'type' ) . '">' . $type->name . '</a></li>'; | |
} | |
echo '</ul></div>'; | |
} | |
//add_action( 'wp', 'be_action_handler' ); | |
//function be_action_handler() | |
{ | |
if ( is_tax( 'Works' ) || is_post_type_archive( 'portfolio' ) ) | |
add_action( 'genesis_before_loop', 'be_sort_projects' ); | |
} | |
// No Post Info | |
remove_action( 'genesis_before_post_title', 'genesis_post_info' ); | |
/** Create Portfolio custom post type */ | |
add_action( 'init', 'minimum_portfolio_post_type' ); | |
function minimum_portfolio_post_type() { | |
register_post_type( 'portfolio', | |
array( | |
'labels' => array( | |
'name' => __( 'Portfolio', 'minimum' ), | |
'singular_name' => __( 'Portfolio', 'minimum' ), | |
), | |
'exclude_from_search' => true, | |
'has_archive' => true, | |
'hierarchical' => true, | |
'menu_icon' => get_stylesheet_directory_uri() . '/images/icons/portfolio.png', | |
'public' => true, | |
'rewrite' => array( 'slug' => 'work' ), | |
'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'trackbacks', 'custom-fields', 'comments', 'revisions', 'page-attributes', 'genesis-seo' ), | |
'taxonomies' => array('Works') | |
) | |
); | |
} | |
/** Change the number of portfolio items to be displayed (props Bill Erickson) */ | |
add_action( 'pre_get_posts', 'minimum_portfolio_items' ); | |
function minimum_portfolio_items( $query ) { | |
if( $query->is_main_query() && !is_admin() && is_post_type_archive( 'commissions' ) ) { | |
$query->set( 'posts_per_page', '12' ); | |
} | |
} | |
/** Register widget areas */ | |
genesis_register_sidebar( array( | |
'id' => 'home-featured-1', | |
'name' => __( 'Home Featured #1', 'minimum' ), | |
'description' => __( 'This is the home featured #1 section.', 'minimum' ), | |
) ); | |
genesis_register_sidebar( array( | |
'id' => 'home-featured-2', | |
'name' => __( 'Home Featured #2', 'minimum' ), | |
'description' => __( 'This is the home featured #2 section.', 'minimum' ), | |
) ); | |
genesis_register_sidebar( array( | |
'id' => 'home-featured-3', | |
'name' => __( 'Home Featured #3', 'minimum' ), | |
'description' => __( 'This is the home featured #3 section.', 'minimum' ), | |
) ); | |
genesis_register_sidebar( array( | |
'id' => 'home-featured-4', | |
'name' => __( 'Home Featured #4', 'minimum' ), | |
'description' => __( 'This is the home featured #4 section.', 'minimum' ), | |
) ); | |
genesis_register_sidebar( array( | |
'id' => 'custom-footer', | |
'name' => __( 'Custom Footer', 'minimum' ), | |
'description' => __( 'This is the custom footer section.', 'minimum' ), | |
) ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment