Created
March 23, 2018 15:08
-
-
Save amostajo/4d51c4e3683b75658a79af2ea033bdfe to your computer and use it in GitHub Desktop.
Lightbox2 in Post Gallery plugin view
This file contains hidden or 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
<style type="text/css"> | |
.post-gallery a {position: relative;} | |
.post-gallery .is-video:before { | |
content: "\f236"; position: absolute; font-family: Dashicons; font-size: 50px; | |
color: #fff; top: calc(50% - 30px); left: calc(50% - 30px); text-shadow: 0 0 4px #000; | |
} | |
</style> | |
<div class="post-gallery"> | |
<?php foreach ( $post->gallery as $attachment ) : ?> | |
<a href="<?php echo $attachment->is_video ? $attachment->video_url : $attachment->url ?>" | |
<?php if ( $attachment->is_video ) : ?> | |
class="is-video" | |
<?php else : ?> | |
data-lightbox="post-gallery-<?php echo $post->ID ?>" | |
<?php if ( $attachment->caption ) : ?> | |
data-title="<?php echo $attachment->caption ?>" | |
<?php endif ?> | |
<?php endif ?> | |
> | |
<img src="<?php echo $attachment->thumb_url ?>" | |
alt="<?php echo $attachment->alt ?>" | |
/> | |
</a> | |
<?php endforeach ?> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment