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);
@ -223,7 +223,7 @@
@media only screen and (max-width: 380px) { @media only screen and (max-width: 380px) {
margin: 10px 0; margin: 10px 0;
} }
img { img {
border-radius: var(--borderRadius, 3px); border-radius: var(--borderRadius, 3px);
width: var(--attachments-size, 140px); width: var(--attachments-size, 140px);

View File

@ -55,38 +55,57 @@ $page_container_style .= 'background-color: var(--tainacan-background-color, #f8
<div class="tainacan-collection-header__box"> <div class="tainacan-collection-header__box">
<?php <?php
$thumbnail_element = ''; $thumbnail_element = '';
$is_thumbnail_enabled = false; $description_element = '';
$hero_elements = blocksy_akg_or_customizer(
'hero_elements', $is_thumbnail_enabled = false;
[ 'prefix' => $prefix ], $is_description_enabled = false;
[]
); $hero_elements = blocksy_akg_or_customizer(
foreach ($hero_elements as $index => $single_hero_element) { 'hero_elements',
if ($single_hero_element['id'] == 'custom_thumbnail') { [ 'prefix' => $prefix ],
$is_thumbnail_enabled = $single_hero_element['enabled']; []
);
foreach ($hero_elements as $index => $single_hero_element) {
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);
$thumbnail_element = '
<div class="collection-thumbnail">
<img src="' . get_the_post_thumbnail_url( tainacan_get_collection_id() ) . '" alt="' . esc_attr($alt) . '">
</div>
';
} 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>';
}
} }
}
if ( $is_thumbnail_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);
$thumbnail_element = ' $elements =
<div class="collection-thumbnail"> $thumbnail_element .
<img src="' . get_the_post_thumbnail_url( tainacan_get_collection_id() ) . '" alt="' . esc_attr($alt) . '"> blocksy_render_view(
</div> get_template_directory() . '/inc/components/hero/elements.php', [ 'type' => 'type-1' ]
'; ) .
$description_element;
endif;
echo blocksy_output_hero_section([
$elements = $thumbnail_element . blocksy_render_view( 'type' => 'type-1',
get_template_directory() . '/inc/components/hero/elements.php', [ 'type' => 'type-1' ] 'source' => false,
); 'elements' => $elements
echo blocksy_output_hero_section([ ]);
'type' => 'type-1',
'source' => false,
'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)';
} }
} }
?> ?>