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') ) { if ( !function_exists('blocksy_tainacan_update_extensions_paths') ) {
function blocksy_tainacan_update_extensions_paths($paths) { function blocksy_tainacan_update_extensions_paths($paths) {
var_dump($paths);
return $paths; return $paths;
} }
} }

View File

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

View File

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