Skip to content

Instantly share code, notes, and snippets.

@bigin
Last active July 11, 2017 19:12
Show Gist options
  • Save bigin/f4d6557bb8a7e07be3040857ab50005a to your computer and use it in GitHub Desktop.
Save bigin/f4d6557bb8a7e07be3040857ab50005a to your computer and use it in GitHub Desktop.
<?php if(!defined('IN_GS')){ die('you cannot load this page directly.'); } ?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>Catalog Template</title>
<!-- Bootstrap -->
<link href="<?php get_theme_url(); ?>/css/bootstrap.min.css" rel="stylesheet">
<link href="<?php get_theme_url(); ?>/css/styles.css" rel="stylesheet">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="jumbotron">
<div class="container">
<h1>Product List</h1>
<p>Product list example based on ItemManager and SimpleCatalog plugin</p>
<p>
<a class="btn btn-lg btn-primary" href="#" role="button">View navbar docs »</a>
</p>
</div>
</div>
<div class="container">
<?php
echo ($msg) ? $msg : '';
// Item list view
if($items) {
?>
<div class="well well-sm breadcrumbs">
<?php
// Build the breadcrumb navigation
echo '<a href="'.$catalog->processor->config->startPageUri.'">'.$category->name.'</a>';
if($urlSegments[0] == 'tags') {
echo '<span class="bc-separator">›</span><span class="bc-active">Tags</span>';
}
?>
</div>
<div id="products" class="row list-group">
<?php
foreach($items as $item) {
?>
<div class="item col-xs-4 col-lg-4">
<div class="thumbnail">
<?php echo isset($item->thumbnail) ? '<a href="'.$catalog->processor->config->startPageUri.$item->slug.'/">
<img class="group list-group-image" src="'.$item->thumbnail.'" alt="'.$item->image_title[0].'" /></a>' : ''; ?>
<div class="caption">
<h4 class="group inner list-group-item-heading">
<?php
// Make the product title clickable
echo '<a href="'.$catalog->processor->config->startPageUri.$item->slug.'/">'.$item->name.'</a>';
?>
</h4>
<p class="group inner list-group-item-text">
<?php echo $item->summary ?></p>
<div class="row">
<div class="col-xs-12">
<p class="ts-1"><?php echo $item->tags ?></p>
</div>
</div>
</div>
</div>
</div>
<?php
}
echo $pagination;
?>
</div>
<?php
// Item details view
} elseif(isset($currentItem->id)) {
?>
<div class="well well-sm breadcrumbs">
<?php
// Build the breadcrumb navigation
echo '<a href="'.$catalog->processor->config->startPageUri.'">'.$category->name.'</a>';
if(isset($currentItem->id)) {
echo '<span class="bc-separator">›</span><span class="bc-active">Product details</span>';
}
?>
</div>
<div class="container row item-wrapper">
<h2><?php echo $currentItem->name ?></h2>
<p><span class="text-muted">Similar articles:</span> <?php echo $currentItem->tags ?></p>
<hr>
<div class="col-md-1">
<p class="item-date"><?php echo ($currentItem->updated) ?
date('j. M', $currentItem->updated) : date('j. M', $currentItem->created) ?></p>
</div>
<div class="col-md-6">
<?php echo $currentItem->description; ?>
</div>
<div class="col-md-5">
<figure>
<?php echo ($currentItem->thumbnail) ? '<img class="group list-group-image" src="'.
$currentItem->thumbnail.'" alt="'.$currentItem->image_title[0].'" />' : ''; ?>
</figure>
</div>
</div>
<?php
// Default page content
} else {
get_page_content();
}
?>
</div>
<footer>
<div class="footer-bottom">
<div class="container">
<p class="pull-left">Based on <a href="#">SimpleCatalog</a> and <a href="#">ItemManager</a></p>
</div>
</div>
</footer>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="<?php get_theme_url(); ?>/js/bootstrap.min.js"></script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment