Created
September 13, 2012 05:28
-
-
Save anonymous/3712088 to your computer and use it in GitHub Desktop.
Sample Child Theme with Post Format
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' ); | |
/** Child theme (do not remove) */ | |
define( 'CHILD_THEME_NAME', 'Sample Child Theme' ); | |
define( 'CHILD_THEME_URL', 'http://www.studiopress.com/themes/genesis' ); | |
/** Add Viewport meta tag for mobile browsers */ | |
add_action( 'genesis_meta', 'add_viewport_meta_tag' ); | |
function add_viewport_meta_tag() { | |
echo '<meta name="viewport" content="width=device-width, initial-scale=1.0"/>'; | |
} | |
/** Add support for custom background */ | |
add_custom_background(); | |
/** Add support for custom header */ | |
add_theme_support( 'genesis-custom-header', array( 'width' => 960, 'height' => 100 ) ); | |
/** Add support for 3-column footer widgets */ | |
add_theme_support( 'genesis-footer-widgets', 3 ); | |
/** Add support for post formats */ | |
add_theme_support( 'post-formats', array( 'aside', 'audio', 'chat', 'gallery', 'image', 'link', 'quote', 'status', 'video' ) ); | |
/** Add support for post format images */ | |
add_theme_support( 'genesis-post-format-images' ); | |
/** | |
* Exclude Post Formats from Blog | |
* | |
* @author Bill Erickson | |
* @link http://www.billerickson.net/customize-the-wordpress-query/ | |
* @param object $query data | |
* | |
*/ | |
function be_exclude_post_formats_from_blog( $query ) { | |
if( $query->is_main_query() && $query->is_home() ) { | |
$tax_query = array( | |
'taxonomy' => 'post_format', | |
'field' => 'slug', | |
'terms' => array( 'post-format-quote', 'post-format-image' ), | |
'operator' => 'NOT IN', | |
); | |
$query->set( 'tax_query', $tax_query ); | |
} | |
} | |
add_action( 'pre_get_posts', 'be_exclude_post_formats_from_blog' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment