Skip to content

Instantly share code, notes, and snippets.

@jaybuys
Last active August 25, 2017 00:41
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jaybuys/7895238 to your computer and use it in GitHub Desktop.
Save jaybuys/7895238 to your computer and use it in GitHub Desktop.
Make WooSlider plugin show full HTML content instead of excerpts in slide layout. Place this code in your WordPress theme functions.php file.
<?php
add_filter( 'wooslider_slides_layout_html', 'wooslider_custom_content', 10, 3);
function wooslider_custom_content ( $content, $args, $post ) {
global $post;
$image = get_the_post_thumbnail( get_the_ID() );
if ( 'true' == $args['link_slide'] || 1 == $args['link_slide'] ) {
$wooslider_url = get_post_meta( get_the_ID(), '_wooslider_url', true );
$image = '<a href="' . esc_url( $wooslider_url ) . '">' . $image . '</a>';
}
if ( ( 'true' == $args['display_content'] || 1 == $args['display_content'] ) || ( 'true' == $args['display_title'] || 1 == $args['display_title'] ) ) {
$title = get_the_title();
$content = get_the_content();
$content = apply_filters('the_content', $content);
$content = str_replace(']]>', ']]&gt;', $content);
$content = '<div class="slide-excerpt"><h2 class="slide-title">' . $title . '</h2>' . $content . '</div>';
if ( $args['layout'] == 'text-top' ) {
$content = $content . $image;
} else {
$content = $image . $content;
}
} else {
$content = $image;
}
return $content;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment