Skip to content

Instantly share code, notes, and snippets.

@bigin
Last active May 14, 2017 19:17
Show Gist options
  • Save bigin/064492b6b56c7a9c6d6bde88533340e5 to your computer and use it in GitHub Desktop.
Save bigin/064492b6b56c7a9c6d6bde88533340e5 to your computer and use it in GitHub Desktop.
<?php
// You must replace * with your category id here!
$category_id = *;
$catalog->processor->config->frontendItemsPerPage = 50;
$params = array( 'section' => 'frontend', 'selector' => 'active=1', 'pageurl' => '?page=');
$result = $catalog->processor->getItems($category_id, $params);
$rows = '';
if(!empty($result['items'])) {
foreach($result['items'] as $key => $item) {
$path = \ImCatalog\Util::getResizedUrl($item, 0, 900, 900, 'resize');
$thumb_path = \ImCatalog\Util::getResizedUrl($item, 0, 300, 300, 'adaptiveResize');
$rows .= '<a href="'.$path.'"><img src="'.$thumb_path.'" alt="" title="'.$item->image_title[0].'"/></a>';
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<title>SimpleCatalos as Lightbox</title>
<link href="https://fonts.googleapis.com/css?family=Raleway:300,400,700" rel="stylesheet">
<link href='<?php get_theme_url(); ?>/simplelightbox/dist/simplelightbox.min.css' rel='stylesheet' type='text/css'>
<link href='<?php get_theme_url(); ?>/css/simple-catalog/lightbox.css' rel='stylesheet' type='text/css'>
</head>
<body>
<div class="container">
<h1 class="align-center">Lightbox Demo Page</h1>
<div class="gallery">
<?php echo $rows; ?>
</div>
<p>All images are free availabled on <a href="https://unsplash.com/" target="_blank">Unsplash</a></p>
<p>Documentation and download <a target="_blank" href="http://andreknieriem.de/simple-lightbox/">here</a></p>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
<script type="text/javascript" src="<?php get_theme_url(); ?>/simplelightbox/dist/simple-lightbox.js"></script>
<script>
$(function(){
var gallery = $('.gallery a').simpleLightbox();
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment