Skip to content

Instantly share code, notes, and snippets.

@rfmeier
Created June 5, 2013 13:36
Show Gist options
  • Save rfmeier/5713886 to your computer and use it in GitHub Desktop.
Save rfmeier/5713886 to your computer and use it in GitHub Desktop.
Hide post title and info depending on the post's category
<?php
add_filter( 'genesis_post_title_output', 'custom_genesis_post_title_output' );
/**
* Callback for Genesis 'genesis_post_title_output' filter.
*
* Remove the title if the post category is 'portfolio'.
*
* @package Genesis
* @category Post Title
* @author Ryan Meier http://www.rfmeier.net
*
* @param string $title The post title output
* @return string $title The post title output
*/
function custom_genesis_post_title_output( $title ){
// if post is in 'portfolio' category, return empty string
if( is_category( 'portfolio' ) )
return '';
// else, return default title output
return $title;
}
add_filter( 'genesis_post_info', 'custom_genesis_post_info' );
/**
* Callback for Genesis 'genesis_post_info' filter.
*
* If the current post is in the '' category, hide the post info content
*
* @package Genesis
* @category Post Info
* @author Ryan Meier http://www.rfmeier.net
*
* @param string $post_info The post info content
* @return string $post_info The post info content
*/
function custom_genesis_post_info( $post_info ){
// if post is in 'portfolio' category, return empty string
if( is_category( 'portfolio' ) )
return '';
// else, return default post info
return $post_info;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment