Last active
August 25, 2017 00:41
-
-
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.
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( '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(']]>', ']]>', $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