Skip to content

Instantly share code, notes, and snippets.

@tomharrigan
Created January 6, 2013 10:55
Show Gist options
  • Select an option

  • Save tomharrigan/4466547 to your computer and use it in GitHub Desktop.

Select an option

Save tomharrigan/4466547 to your computer and use it in GitHub Desktop.
Get meta data excerpts if available, otherwise use get_the_excerpt().
if($instance['post_type'] == 'features'){
$exc = get_post_meta( get_the_ID(), 'feature_excerpt', true );
if ( $exc != '' ) {
$exc = stripslashes( $exc );
} else {
$exc = strip_tags( get_the_excerpt() );
}
} else if($instance['post_type'] == 'feedback'){
$exc = get_post_meta( get_the_ID(), 'feedback_excerpt', true );
if ( $exc != '' ) {
$exc = stripslashes( $exc );
} else {
$exc = strip_tags( get_the_excerpt() );
}
} else {
$exc = strip_tags( get_the_excerpt() );
}
$html .= '<div class="widget-slider-excerpt">' . $exc . '</div>' . "\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment