2020-11-25 16:20:54 +00:00
|
|
|
<?php
|
|
|
|
/**
|
2021-02-18 01:52:55 +00:00
|
|
|
* The template for displaying all single Tainacan items
|
2020-11-25 16:20:54 +00:00
|
|
|
*
|
|
|
|
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/#single-post
|
|
|
|
*
|
|
|
|
* @package BlocksyTainacan
|
|
|
|
*/
|
|
|
|
|
2020-12-29 04:33:20 +00:00
|
|
|
$prefix = blocksy_manager()->screen->get_prefix();
|
2020-11-25 16:20:54 +00:00
|
|
|
|
2020-12-30 03:31:53 +00:00
|
|
|
$page_structure_type = get_theme_mod( $prefix . '_page_structure_type', 'type-dam');
|
|
|
|
$template_columns_style = '';
|
2021-07-08 02:21:21 +00:00
|
|
|
$display_items_related_to_this = get_theme_mod( $prefix . '_display_items_related_to_this', 'no' ) === 'yes';
|
2022-10-04 20:50:25 +00:00
|
|
|
$column_documents_attachments_affix = get_theme_mod( $prefix . '_document_attachments_affix', 'no') === 'yes';
|
2020-12-30 03:31:53 +00:00
|
|
|
|
|
|
|
if ($page_structure_type == 'type-gm' || $page_structure_type == 'type-mg') {
|
|
|
|
$column_documents_attachments_width = 60;
|
|
|
|
$column_metadata_width = 40;
|
|
|
|
|
|
|
|
$column_documents_attachments_width = intval(substr(get_theme_mod( $prefix . '_document_attachments_columns', '60%'), 0, -1));
|
|
|
|
$column_metadata_width = 100 - $column_documents_attachments_width;
|
|
|
|
|
|
|
|
if ($page_structure_type == 'type-gm') {
|
2022-09-30 14:22:34 +00:00
|
|
|
$template_columns_style = 'grid-template-columns: ' . $column_documents_attachments_width . '% calc(' . $column_metadata_width . '% - 48px);';
|
2020-12-30 03:31:53 +00:00
|
|
|
} else {
|
2022-09-30 14:22:34 +00:00
|
|
|
$template_columns_style = 'grid-template-columns: ' . $column_metadata_width . '% calc(' . $column_documents_attachments_width . '% - 48px);';
|
2020-12-30 03:31:53 +00:00
|
|
|
}
|
|
|
|
}
|
2021-07-06 18:11:01 +00:00
|
|
|
|
|
|
|
do_action( 'tainacan-blocksy-single-item-top' );
|
|
|
|
|
|
|
|
do_action( 'tainacan-blocksy-single-item-after-title' );
|
|
|
|
|
2021-02-18 01:52:55 +00:00
|
|
|
?>
|
2020-12-30 03:31:53 +00:00
|
|
|
|
2022-09-30 14:22:34 +00:00
|
|
|
<div class="<?php echo esc_attr('tainacan-item-single tainacan-item-single--layout-'. $page_structure_type . ($column_documents_attachments_affix ? ' tainacan-item-single--affix-column' : '')) ?>" style="<?php echo esc_attr($template_columns_style) ?>">
|
2021-02-18 01:52:55 +00:00
|
|
|
<?php
|
2021-07-06 18:11:01 +00:00
|
|
|
if ($page_structure_type !== 'type-gtm') {
|
|
|
|
tainacan_blocksy_get_template_part( 'template-parts/tainacan-item-single-document' );
|
|
|
|
do_action( 'tainacan-blocksy-single-item-after-document' );
|
2020-11-25 16:20:54 +00:00
|
|
|
|
2021-07-06 18:11:01 +00:00
|
|
|
tainacan_blocksy_get_template_part( 'template-parts/tainacan-item-single-attachments' );
|
|
|
|
do_action( 'tainacan-blocksy-single-item-after-attachments' );
|
|
|
|
}
|
2020-12-29 04:33:20 +00:00
|
|
|
|
2021-04-14 17:40:23 +00:00
|
|
|
tainacan_blocksy_get_template_part( 'template-parts/tainacan-item-single-metadata' );
|
|
|
|
do_action( 'tainacan-blocksy-single-item-after-metadata' );
|
2021-07-08 02:21:21 +00:00
|
|
|
|
|
|
|
if ($display_items_related_to_this) {
|
|
|
|
tainacan_blocksy_get_template_part( 'template-parts/tainacan-item-single-items-related-to-this' );
|
|
|
|
do_action( 'tainacan-blocksy-single-item-after-items-related-to-this' );
|
|
|
|
}
|
2021-02-18 01:52:55 +00:00
|
|
|
?>
|
|
|
|
</div>
|
2020-11-25 16:20:54 +00:00
|
|
|
|
2021-04-29 20:13:03 +00:00
|
|
|
|
2021-02-27 16:15:47 +00:00
|
|
|
<?php
|
|
|
|
// Edit item button
|
|
|
|
if ( function_exists('tainacan_the_item_edit_link') ) {
|
2021-04-29 20:13:03 +00:00
|
|
|
echo '<div class="tainacan-item-single"><span class="tainacan-edit-item-collection">';
|
2021-02-27 16:15:47 +00:00
|
|
|
tainacan_the_item_edit_link();
|
2021-04-29 20:13:03 +00:00
|
|
|
echo '</span></div>';
|
2021-02-27 16:15:47 +00:00
|
|
|
}
|
2021-04-29 20:13:03 +00:00
|
|
|
do_action( 'tainacan-blocksy-single-item-bottom' );
|
2021-02-27 16:15:47 +00:00
|
|
|
?>
|