Skip to content

Instantly share code, notes, and snippets.

@jeremyboggs
Created August 7, 2013 21:11
Show Gist options
  • Save jeremyboggs/6178723 to your computer and use it in GitHub Desktop.
Save jeremyboggs/6178723 to your computer and use it in GitHub Desktop.
Display five recent Neatline exhibits on your Omeka home page. (For Omeka 2.0.). Add this code to your theme's custom.php file.
<?php
function display_recent_neatline_exhibits() {
$html = '';
// Get our recent exhibits, limited to five.
$neatlineExhibits = get_records('NeatlineExhibit', array('recent' => true), 5);
// Set them for the loop.
set_loop_records('NeatlineExhibit', $neatlineExhibits);
// If we have any to loop, we'll append to $html.
if (has_loop_records('NeatlineExhibit')) {
$html .= '<ul>';
foreach (loop('NeatlineExhibit') as $exhibit) {
$html .= '<li>'
. nl_getExhibitLink(
$exhibit, 'show', metadata($exhibit, 'title'),
array('class' => 'neatline'), true
)
. '</li>';
}
}
echo $html;
}
add_plugin_hook('public_home', 'display_recent_neatline_exhibits');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment