Skip to content

Instantly share code, notes, and snippets.

@anestan
Last active August 29, 2015 14:22
Show Gist options
  • Save anestan/75d29814901f01f274e9 to your computer and use it in GitHub Desktop.
Save anestan/75d29814901f01f274e9 to your computer and use it in GitHub Desktop.
icelock - add attachment title for flexslider
echo "<div class='gallery-wrap'><div class='flexslider'><ul class='slides'>";
foreach ($id as $image_id) {
if ( is_single() ) {
echo "<li> <a href='". wp_get_attachment_url($image_id) ."'>";
} else {
echo "<li> <a href='". get_permalink($post->ID) ."'>";
}
echo wp_get_attachment_image($image_id, 'featured-image', false, false);
echo "</a>";
$image_title = get_the_title( $image_id );
echo "<p class='flex-caption'>" . $image_title . "</p></li>";
}
echo "</ul></div></div>";
@anestan
Copy link
Author

anestan commented Jun 6, 2015

Add this to style.css for style above code for flex-caption

.gallery-wrap {
margin-bottom: 60px;
}

.flex-caption {
font-size: 12px;
font-style: italic;
color: #555;
text-align: center;
position: absolute;
left: 0px;
right: 0px;
padding: 10px;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment