public
Created

  • Download Gist
functions.php
PHP
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
<?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;
 
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.