Skip to content

Commit

Permalink
Add custom browse page to seasons theme
Browse files Browse the repository at this point in the history
Adds creator and date to displayed results
Allows sorting by DublinCore Date (instead of item added/created date)
  • Loading branch information
andrew-gardener committed Dec 14, 2024
1 parent dd7224e commit 9b84b05
Showing 1 changed file with 77 additions and 0 deletions.
77 changes: 77 additions & 0 deletions themes/seasons/items/browse.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<?php
$pageTitle = __('Browse Items');
echo head(array('title' => $pageTitle, 'bodyclass' => 'items browse'));
?>

<h1><?php echo $pageTitle;?> <?php echo __('(%s total)', $total_results); ?></h1>

<nav class="items-nav navigation secondary-nav">
<?php echo public_nav_items(); ?>
</nav>

<?php echo item_search_filters(); ?>

<?php echo pagination_links(['attributes' => ['aria-label' => __('Top pagination')]]); ?>

<?php if ($total_results > 0): ?>

<?php
$sortLinks[__('Title')] = 'Dublin Core,Title';
$sortLinks[__('Creator')] = 'Dublin Core,Creator';
$sortLinks[__('Date')] = 'Dublin Core,Date';
?>
<div id="sort-links">
<span class="sort-label"><?php echo __('Sort by: '); ?></span><?php echo browse_sort_links($sortLinks); ?>
</div>

<?php endif; ?>

<?php foreach (loop('items') as $item): ?>
<div class="item hentry">
<h2><?php echo link_to_item(null, array('class' => 'permalink')); ?></h2>
<div class="item-meta">
<?php if (metadata('item', 'has files')): ?>
<div class="item-img">
<?php echo link_to_item(item_image(null)); ?>
</div>
<?php endif; ?>

<?php if ($description = metadata('item', array('Dublin Core', 'Description'), array('snippet' => 250))): ?>
<div class="item-description">
<?php echo $description; ?>
</div>
<?php endif; ?>

<?php if ($metadataCreator = metadata('item', array('Dublin Core', 'Creator'))): ?>
<div><strong><?php echo __('Creator'); ?>:</strong>
<?php echo $metadataCreator; ?>
</div>
<?php endif; ?>

<?php if ($metadataDate = metadata('item', array('Dublin Core', 'Date'))): ?>
<div><strong><?php echo __('Date'); ?>:</strong>
<?php echo $metadataDate; ?>
</div>
<?php endif; ?>

<?php if (metadata('item', 'has tags')): ?>
<div class="tags"><strong><?php echo __('Tags'); ?>:</strong>
<?php echo tag_string('items'); ?>
</div>
<?php endif; ?>

<?php fire_plugin_hook('public_items_browse_each', array('view' => $this, 'item' => $item)); ?>
</div><!-- end class="item-meta" -->
</div><!-- end class="item hentry" -->
<?php endforeach; ?>

<?php echo pagination_links(['attributes' => ['aria-label' => __('Bottom pagination')]]); ?>

<div id="outputs">
<span class="outputs-label"><?php echo __('Output Formats'); ?></span>
<?php echo output_format_list(false); ?>
</div>

<?php fire_plugin_hook('public_items_browse', array('items' => $items, 'view' => $this)); ?>

<?php echo foot(); ?>

0 comments on commit 9b84b05

Please sign in to comment.