Skip to content

Instantly share code, notes, and snippets.

@craigrodway
Created April 19, 2014 23:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save craigrodway/ca9b98d503bf7b51f151 to your computer and use it in GitHub Desktop.
Save craigrodway/ca9b98d503bf7b51f151 to your computer and use it in GitHub Desktop.
ProcessWire photos
<?php include("./head.inc"); ?>
<div class="grid_12 content">
<h1><?php echo $page->title ?></h1>
<p><?php echo $page->summary ?></p>
<div class="photo-wrapper clearfix photos">
<?php $photos = wire("page")->photos; ?>
<?php foreach ($photos as $photo): ?>
<div class="photo single">
<a href="<?php echo $photo->size(1024)->url ?>" title="<?php echo $photo->description ?>">
<img class="max-img border-primary" src="<?php echo $photo->size(260, 260)->url ?>" alt="<?php echo $photo->description ?>">
</a>
</div>
<?php endforeach; ?>
</div>
</div>
<script>
Q.push(function() {
$(document).ready(function() {
var photoswipe = $(".photos a").photoSwipe({
enableMouseWheel: false,
enableKeyboard: true,
allowUserZoom: false,
imageScaleMethod: "fitNoUpscale"
});
});
});
</script>
<?php include("./foot.inc"); ?>
<?php include("./head.inc"); ?>
<div class="grid_12 content">
<div class="photo-wrapper clearfix">
<?php $albums = wire("pages")->find("parent=/photos/, template=photos, sort=-created"); ?>
<?php foreach($albums as $album): ?>
<div class="photo">
<a href="<?php echo $album->url ?>">
<img class="max-img" src="<?php echo $album->photos->first()->size(260, 260)->url ?>"><!--
--></a>
<br>
<h6 class="title"><strong><?php echo $album->title ?></strong></h6>
<p class="when"><?php echo date('j F Y', $album->created) ?></p>
</div>
<?php endforeach; ?>
</div>
</div>
<?php include("./foot.inc"); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment