screen->get_prefix();
$section_layout = get_theme_mod($prefix . '_metadata_sections_layout_type', 'metadata-section-type-1');
$exclude_title_metadata = get_theme_mod($prefix . '_show_title_metadata', 'yes') === 'no';
$show_thumbnail_with_metadata = get_theme_mod($prefix . '_show_thumbnail', 'no') === 'yes';
$metadata_list_structure_type = get_theme_mod($prefix . '_metadata_list_structure_type', 'metadata-type-1');
$display_section_labels = get_theme_mod($prefix . '_display_section_labels', 'yes') == 'yes';
$show_default_section_separated =
in_array($section_layout, ['metadata-section-type-2', 'metadata-section-type-3', 'metadata-section-type-4']) &&
get_theme_mod($prefix . '_metadata_sections_separate_default_section', 'no') === 'yes';
/**
* The new metadata sections function makes it a bit more complicated to add
* the thumbnail in the middle of the metadata.
* So we have some logic that is only needed if it is set.
* The following uses a filter to add it right above the first metadatum in the first section.
**/
if ( has_post_thumbnail() && $show_thumbnail_with_metadata ) {
// Gets collection so we can obtain firtst metadatum
$collection = tainacan_get_collection();
if ( !is_null($collection) ) {
// Gets array of metadata order
$metadata_order = $collection->get_metadata_order();
if ( is_array($metadata_order) ) {
$first_metadatum_id = -1;
foreach( $metadata_order as $metadatum ) {
// Checks if the metadata is enabled
if ( isset($metadatum['enabled']) && $metadatum['enabled'] && isset($metadatum['id']) ) {
$first_metadatum_id = $metadatum['id'];
// IF we are not displaying the title here, we must look for the second metadata
if ( $exclude_title_metadata ) {
$Tainacan_Metadata = \Tainacan\Repositories\Metadata::get_instance();
$metadatum_object = $Tainacan_Metadata->fetch($first_metadatum_id);
$metadata_type_object = $metadatum_object->get_metadata_type_object();
if ( $metadata_type_object->get_related_mapped_prop() == 'title' ) {
continue;
}
}
break;
}
}
if ( is_numeric($first_metadatum_id) && $first_metadatum_id >= 0 ) {
add_filter('tainacan-get-item-metadatum-as-html-before--id-' . $first_metadatum_id, function($before, $item_metadatum) {
ob_start();
?>