Skip to content

Commit

Permalink
Clean up custom featured records function
Browse files Browse the repository at this point in the history
  • Loading branch information
kimisgold committed Jan 27, 2023
1 parent 4ae135c commit 9c0ff51
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function thanksroy_brighten($color, $steps) {
*
* @return string
*/
function thanksroy_exhibit_builder_display_random_featured_records($type = null, $count = 2, $hasImage = null)
function thanksroy_display_random_featured_records($type = null, $count = 2, $hasImage = null)
{
$records = get_records(strtoupper($type), array('featured' => 1,
'sort_field' => 'random',
Expand All @@ -49,9 +49,11 @@ function thanksroy_exhibit_builder_display_random_featured_records($type = null,
$html .= get_view()->partial($recordPaths[$type] . 'single.php', array($type => $record));
release_object($record);
}
if ($type == 'exhibits') {
$html = apply_filters('exhibit_builder_display_random_featured_exhibit', $html);
}
} else {
$html .= '<p>' . __('You have no featured exhibits.') . '</p>';
}
$html = apply_filters('exhibit_builder_display_random_featured_exhibit', $html);
return $html;
}
4 changes: 2 additions & 2 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
<div id="featured-records">
<?php if ((get_theme_option('Display Featured Exhibit')) && function_exists('exhibit_builder_display_random_featured_exhibit')): ?>
<!-- Featured Exhibit(s) -->
<?php echo thanksroy_exhibit_builder_display_random_featured_records('exhibit', 2); ?>
<?php echo thanksroy_display_random_featured_records('exhibit', 2); ?>
<?php endif; ?>
<?php if (get_theme_option('Display Featured Collection')): ?>
<!-- Featured Collection(s) -->
<?php echo thanksroy_exhibit_builder_display_random_featured_records('collection', 2); ?>
<?php echo thanksroy_display_random_featured_records('collection', 2); ?>
<?php endif; ?>
<?php if (get_theme_option('Display Featured Item') == 1): ?>
<!-- Featured Item(s) -->
Expand Down

0 comments on commit 9c0ff51

Please sign in to comment.