Skip to content

Instantly share code, notes, and snippets.

@dovy
Created October 1, 2014 19:15
Show Gist options
  • Save dovy/574b584398ff55df2a33 to your computer and use it in GitHub Desktop.
Save dovy/574b584398ff55df2a33 to your computer and use it in GitHub Desktop.
if ( isset($flexslider) && $images = get_children( array(
'post_parent' => get_the_ID(),
'post_type' => 'attachment',
'order' => 'ASC',
'orderby' => 'ID',
'post_mime_type' => 'image',
) )
) {
global $content_width;
$size = 'rdx_blog_' . $content_width . '_archive';
echo '<div class="flexslider"><ul class="slides">';
foreach ( $images as $image ) {
$attachmentimage = wp_get_attachment_image( $image->ID, $size );
$img_title = ! empty( $image->post_excerpt ) ? '<p class="flex-caption">' . $image->post_excerpt . '"</p>' : '';
$img_desc = $image->post_excerpt;
echo '<li><a href="' . esc_url( get_permalink() ) . '">' . $attachmentimage . $img_title . '</a></li>';
}
echo '</ul></div>';
$post->post_content = strip_shortcodes( $post->post_content );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment