Created
August 7, 2013 21:11
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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