Fixes collection description not being displayed in collection banner.

This commit is contained in:
mateuswetah 2021-02-27 23:27:10 -03:00
parent 32e8f10d5e
commit 7423a06668
4 changed files with 54 additions and 36 deletions

View File

@ -45,7 +45,6 @@ add_action('template_redirect', 'blocksy_tainacan_archive_templates_redirects');
*/
if ( !function_exists('blocksy_tainacan_update_extensions_paths') ) {
function blocksy_tainacan_update_extensions_paths($paths) {
var_dump($paths);
return $paths;
}
}

View File

@ -5,8 +5,8 @@
// Overall page layout structure -------------------
@include display-grid;
align-items: start;
grid-column-gap: 32px;
column-gap: 32px;
grid-column-gap: 48px;
column-gap: 48px;
.tainacan-item-section {
max-width: var(--block-max-width);

View File

@ -56,18 +56,18 @@ $page_container_style .= 'background-color: var(--tainacan-background-color, #f8
<?php
$thumbnail_element = '';
$description_element = '';
$is_thumbnail_enabled = false;
$is_description_enabled = false;
$hero_elements = blocksy_akg_or_customizer(
'hero_elements',
[ 'prefix' => $prefix ],
[]
);
foreach ($hero_elements as $index => $single_hero_element) {
if ($single_hero_element['id'] == 'custom_thumbnail') {
$is_thumbnail_enabled = $single_hero_element['enabled'];
}
}
if ( $is_thumbnail_enabled && has_post_thumbnail( tainacan_get_collection_id() ) ) :
if ($single_hero_element['id'] == 'custom_thumbnail' && $single_hero_element['enabled'] && has_post_thumbnail( tainacan_get_collection_id() )) {
$thumbnail_id = get_post_thumbnail_id( $post->ID );
$alt = get_post_meta($thumbnail_id, '_wp_attachment_image_alt', true);
@ -76,17 +76,36 @@ $page_container_style .= 'background-color: var(--tainacan-background-color, #f8
<img src="' . get_the_post_thumbnail_url( tainacan_get_collection_id() ) . '" alt="' . esc_attr($alt) . '">
</div>
';
endif;
$elements = $thumbnail_element . blocksy_render_view(
get_template_directory() . '/inc/components/hero/elements.php', [ 'type' => 'type-1' ]
} else if ($single_hero_element['id'] == 'custom_description' && $single_hero_element['enabled'] && get_the_archive_description()) {
$description_class = 'page-description';
$description_class .= ' ' . blocksy_visibility_classes(
blocksy_akg(
'description_visibility',
$single_hero_element,
[
'desktop' => true,
'tablet' => true,
'mobile' => false,
]
)
);
$description_element = '<div class="' . $description_class . '">' . get_the_archive_description() . '</div>';
}
}
$elements =
$thumbnail_element .
blocksy_render_view(
get_template_directory() . '/inc/components/hero/elements.php', [ 'type' => 'type-1' ]
) .
$description_element;
echo blocksy_output_hero_section([
'type' => 'type-1',
'source' => false,
'elements' => $elements
]);
?>
</div>
</header>

View File

@ -24,9 +24,9 @@ if ($page_structure_type == 'type-gm' || $page_structure_type == 'type-mg') {
$column_metadata_width = 100 - $column_documents_attachments_width;
if ($page_structure_type == 'type-gm') {
$template_columns_style = 'grid-template-columns: ' . $column_documents_attachments_width . '% calc(' . $column_metadata_width . '% - 32px)';
$template_columns_style = 'grid-template-columns: ' . $column_documents_attachments_width . '% calc(' . $column_metadata_width . '% - 48px)';
} else {
$template_columns_style = 'grid-template-columns: ' . $column_metadata_width . '% calc(' . $column_documents_attachments_width . '% - 32px)';
$template_columns_style = 'grid-template-columns: ' . $column_metadata_width . '% calc(' . $column_documents_attachments_width . '% - 48px)';
}
}
?>