Created
January 11, 2013 15:16
-
-
Save billerickson/4511408 to your computer and use it in GitHub Desktop.
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 | |
add_filter( 'display_posts_shortcode_output', 'be_display_posts_hide_title', 10, 9 ); | |
/** | |
* Display Post Shortcode, Hide Title | |
* Disable title with [display-posts include_title="false"] | |
* | |
* @author Bill Erickson | |
* @link http://wordpress.org/support/topic/how-to-supress-the-title?replies=1#post-3673938 | |
* | |
* @param string $output | |
* @param array $original_atts | |
* @param string $image | |
* @param string $title | |
* @param string $date | |
* @param string $excerpt | |
* @param string $inner_wrapper | |
* @param string $content | |
* @param array $class | |
* @return string output | |
*/ | |
function be_display_posts_hide_title( $output, $original_atts, $image, $title, $date, $excerpt, $inner_wrapper, $content, $class ) { | |
if( isset( $original_atts['include_title'] ) && "false" == $original_atts['include_title'] ) { | |
$title = ''; | |
if ( !empty( $excerpt ) ) | |
$excerpt = '<span class="excerpt">' . get_the_excerpt() . '</span>'; | |
$output = '<' . $inner_wrapper . ' class="' . implode( ' ', $class ) . '">' . $image . $title . $date . $excerpt . $content . '</' . $inner_wrapper . '>'; | |
} | |
return $output; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment