Version 0.1.8 - Archive header fixes.
This commit is contained in:
parent
598dc58996
commit
27a66efc5c
|
@ -5,7 +5,7 @@ Tags: museums, libraries, archives, GLAM, collections, repository, tainacan, blo
|
|||
Requires at least: 5.0
|
||||
Tested up to: 5.7.2
|
||||
Requires PHP: 5.6
|
||||
Stable tag: 0.1.7
|
||||
Stable tag: 0.1.8
|
||||
License: GPLv2 or later
|
||||
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
|
@ -57,6 +57,10 @@ License details: https://github.com/tainacan/blocksy-tainacan/blob/master/LICENS
|
|||
|
||||
|
||||
== Changelog ==
|
||||
|
||||
= 0.1.8 =
|
||||
* Fixes several issues with archive header elements
|
||||
|
||||
= 0.1.7 =
|
||||
* Fixes child theme detection logic when customizer is on
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ Plugin Name: Tainacan Support for Blocksy
|
|||
Plugin URI: https://tainacan.org/
|
||||
Description: Tainacan plugin support for Blocksy theme
|
||||
Author: tainacan
|
||||
Version: 0.1.7
|
||||
Version: 0.1.8
|
||||
Text Domain: tainacan-blocksy
|
||||
License: GPLv2 or later
|
||||
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
@ -15,7 +15,7 @@ if (! defined('WP_DEBUG') ) {
|
|||
}
|
||||
|
||||
/** Theme/plugin version */
|
||||
const TAINACAN_BLOCKSY_VERSION = '0.1.7';
|
||||
const TAINACAN_BLOCKSY_VERSION = '0.1.8';
|
||||
const TAINACAN_BLOCKSY_IS_CHILD_THEME = false;
|
||||
|
||||
/* Tools to define our next constants */
|
||||
|
|
|
@ -0,0 +1,87 @@
|
|||
<?php
|
||||
|
||||
if (! isset($prefix)) {
|
||||
$prefix = '';
|
||||
} else {
|
||||
$prefix = $prefix . '_';
|
||||
}
|
||||
|
||||
$default_hero_elements = [];
|
||||
|
||||
$default_hero_elements[] = [
|
||||
'id' => 'custom_title',
|
||||
'enabled' => true,
|
||||
'heading_tag' => 'h1'
|
||||
];
|
||||
|
||||
$options = [
|
||||
$prefix . 'page-header-panel' => [
|
||||
'label' => __( 'Page header', 'tainacan-blocksy' ),
|
||||
'type' => 'ct-panel',
|
||||
'sync' => blocksy_sync_whole_page([
|
||||
'prefix' => $prefix,
|
||||
]),
|
||||
'inner-options' => [
|
||||
$prefix . 'page_header_background_style' => [
|
||||
'label' => __('Header style', 'tainacan-blocksy'),
|
||||
'type' => 'ct-radio',
|
||||
'value' => 'boxed',
|
||||
'view' => 'text',
|
||||
'choices' => [
|
||||
'simple' => __('Simple', 'blocksy'),
|
||||
'boxed' => __('Boxed', 'blocksy'),
|
||||
],
|
||||
],
|
||||
$prefix . 'hero_elements' => [
|
||||
'label' => __('Elements', 'blocksy'),
|
||||
'type' => 'ct-layers',
|
||||
'attr' => [ 'data-layers' => 'title-elements' ],
|
||||
'design' => 'block',
|
||||
'value' => $default_hero_elements,
|
||||
'sync' => '',
|
||||
|
||||
'settings' => [
|
||||
'custom_title' => [
|
||||
'label' => __('Title', 'blocksy'),
|
||||
'options' => [
|
||||
[
|
||||
'heading_tag' => [
|
||||
'label' => __('Heading tag', 'blocksy'),
|
||||
'type' => 'ct-select',
|
||||
'value' => 'h1',
|
||||
'view' => 'text',
|
||||
'design' => 'inline',
|
||||
'sync' => [
|
||||
'id' => $prefix . 'hero_elements_heading_tag',
|
||||
],
|
||||
'choices' => blocksy_ordered_keys(
|
||||
[
|
||||
'h1' => 'H1',
|
||||
'h2' => 'H2',
|
||||
'h3' => 'H3',
|
||||
'h4' => 'H4',
|
||||
'h5' => 'H5',
|
||||
'h6' => 'H6',
|
||||
]
|
||||
),
|
||||
],
|
||||
],
|
||||
|
||||
'hero_item_spacing' => [
|
||||
'label' => __( 'Top Spacing', 'blocksy' ),
|
||||
'type' => 'ct-slider',
|
||||
'value' => 20,
|
||||
'min' => 0,
|
||||
'max' => 100,
|
||||
'responsive' => true,
|
||||
'sync' => [
|
||||
'id' => $prefix . 'hero_elements_spacing',
|
||||
],
|
||||
],
|
||||
],
|
||||
]
|
||||
]
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
|
@ -8,13 +8,11 @@ if (! isset($prefix)) {
|
|||
|
||||
$default_hero_elements = [];
|
||||
|
||||
|
||||
$default_hero_elements[] = [
|
||||
'id' => 'custom_thumbnail',
|
||||
'enabled' => true,
|
||||
];
|
||||
|
||||
|
||||
$default_hero_elements[] = [
|
||||
'id' => 'custom_title',
|
||||
'enabled' => true,
|
||||
|
@ -23,12 +21,7 @@ $default_hero_elements[] = [
|
|||
|
||||
$default_hero_elements[] = [
|
||||
'id' => 'breadcrumbs',
|
||||
'enabled' => true,
|
||||
'description_visibility' => [
|
||||
'desktop' => true,
|
||||
'tablet' => true,
|
||||
'mobile' => false,
|
||||
]
|
||||
'enabled' => true
|
||||
];
|
||||
|
||||
$default_hero_elements[] = [
|
||||
|
@ -87,19 +80,6 @@ $options = [
|
|||
|
||||
'custom_thumbnail' => [
|
||||
'label' => __('Thumbnail', 'blocksy'),
|
||||
'options' => [
|
||||
'hero_thumbnail_size' => [
|
||||
'label' => __( 'Thumbnail size', 'blocksy' ),
|
||||
'type' => 'ct-slider',
|
||||
'value' => 226,
|
||||
'min' => 36,
|
||||
'max' => 500,
|
||||
'responsive' => true,
|
||||
'sync' => [
|
||||
'id' => $prefix . 'hero_thumbnail_size',
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
|
||||
'custom_title' => [
|
||||
|
@ -191,46 +171,7 @@ $options = [
|
|||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
|
||||
'custom_meta' => [
|
||||
'label' => __('Post Meta', 'blocksy'),
|
||||
'clone' => true,
|
||||
'sync' => [
|
||||
'id' => $prefix . 'hero_elements_meta'
|
||||
],
|
||||
'options' => [
|
||||
|
||||
'hero_item_spacing' => [
|
||||
'label' => __( 'Top Spacing', 'blocksy' ),
|
||||
'type' => 'ct-slider',
|
||||
'value' => 20,
|
||||
'min' => 0,
|
||||
'max' => 100,
|
||||
'responsive' => true,
|
||||
'sync' => [
|
||||
'id' => $prefix . 'hero_elements_spacing',
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
|
||||
'author_social_channels' => [
|
||||
'label' => __('Social Channels', 'blocksy'),
|
||||
'options' => [
|
||||
'hero_item_spacing' => [
|
||||
'label' => __( 'Top Spacing', 'blocksy' ),
|
||||
'type' => 'ct-slider',
|
||||
'value' => 20,
|
||||
'min' => 0,
|
||||
'max' => 100,
|
||||
'responsive' => true,
|
||||
'sync' => [
|
||||
'id' => $prefix . 'hero_elements_spacing',
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
]
|
||||
]
|
||||
],
|
||||
],
|
||||
|
|
|
@ -8,7 +8,12 @@ $options = [
|
|||
],
|
||||
],
|
||||
|
||||
blocksy_get_options(TAINACAN_BLOCKSY_PLUGIN_DIR_PATH . '/inc/options/archive-elements/page-header.php', [
|
||||
blocksy_get_options(
|
||||
(
|
||||
$prefix !== 'tainacan-repository-items' ?
|
||||
TAINACAN_BLOCKSY_PLUGIN_DIR_PATH . '/inc/options/archive-elements/page-header.php' :
|
||||
TAINACAN_BLOCKSY_PLUGIN_DIR_PATH . '/inc/options/archive-elements/page-header-simpler.php'
|
||||
), [
|
||||
'prefix' => $prefix . '_archive'
|
||||
], false),
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ if ( !function_exists('tainacan_blocksy_archive_templates_redirects') ) {
|
|||
}
|
||||
} else if ( $wp_query->get( 'tainacan_repository_archive' ) == 1 ) {
|
||||
|
||||
include( TAINACAN_BLOCKSY_PLUGIN_DIR_PATH . '/tainacan/archive-items.php' );
|
||||
include( TAINACAN_BLOCKSY_PLUGIN_DIR_PATH . '/tainacan/archive-repository.php' );
|
||||
exit;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "tainacan-blocksy",
|
||||
"version": "0.1.7",
|
||||
"version": "0.1.8",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "tainacan-blocksy",
|
||||
"version": "0.1.7",
|
||||
"version": "0.1.8",
|
||||
"description": "A Blocksy plugin/child theme compatible with Tainacan",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
|
|
@ -83,6 +83,8 @@
|
|||
width: 100%;
|
||||
|
||||
#items-list-results {
|
||||
padding-top: 12px;
|
||||
|
||||
.table-container {
|
||||
min-width: 100%;
|
||||
padding-top: 0px;
|
||||
|
|
|
@ -99,6 +99,7 @@
|
|||
}
|
||||
|
||||
.theme-items-list #items-list-area #items-list-results {
|
||||
padding-top: 12px;
|
||||
/* Tainacan items list view modes */
|
||||
/* Pagination */
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -56,27 +56,91 @@ global $post;
|
|||
<div class="tainacan-collection-header__box">
|
||||
<?php
|
||||
|
||||
$thumbnail_element = '';
|
||||
$description_element = '';
|
||||
|
||||
$is_thumbnail_enabled = false;
|
||||
$is_description_enabled = false;
|
||||
|
||||
$hero_elements = blocksy_akg_or_customizer(
|
||||
'hero_elements',
|
||||
[ 'prefix' => $prefix ],
|
||||
[]
|
||||
[
|
||||
[
|
||||
'id' => 'custom_thumbnail',
|
||||
'enabled' => true,
|
||||
],
|
||||
[
|
||||
'id' => 'custom_title',
|
||||
'enabled' => true,
|
||||
'heading_tag' => 'h1'
|
||||
],
|
||||
[
|
||||
'id' => 'breadcrumbs',
|
||||
'enabled' => true
|
||||
],
|
||||
[
|
||||
'id' => 'custom_description',
|
||||
'enabled' => true,
|
||||
'description_visibility' => [
|
||||
'desktop' => true,
|
||||
'tablet' => true,
|
||||
'mobile' => false,
|
||||
]
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
$elements = [];
|
||||
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 = '
|
||||
$elements[] = '
|
||||
<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_title' && $single_hero_element['enabled']) {
|
||||
$title = '';
|
||||
|
||||
$has_category_label = blocksy_akg(
|
||||
'has_category_label',
|
||||
$single_hero_element,
|
||||
'yes'
|
||||
);
|
||||
|
||||
if (! empty(get_the_archive_title())) {
|
||||
$title = wp_strip_all_tags(get_the_archive_title());
|
||||
|
||||
$divider_symbol = ':';
|
||||
|
||||
if (strpos($title, ':') !== false) {
|
||||
$divider_symbol = ':';
|
||||
}
|
||||
|
||||
if (strpos($title, $divider_symbol) !== false) {
|
||||
$title_pieces = explode($divider_symbol, $title, 2);
|
||||
|
||||
$title = '<span class="ct-title-label">' . $title_pieces[0] . '</span>' . $title_pieces[1];
|
||||
|
||||
if ($has_category_label !== 'yes') {
|
||||
$title = $title_pieces[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($title)) {
|
||||
$title = blocksy_html_tag(
|
||||
blocksy_akg('heading_tag', $single_hero_element, 'h1'),
|
||||
array_merge([
|
||||
'class' => 'page-title',
|
||||
], blocksy_schema_org_definitions('headline', [
|
||||
'array' => true
|
||||
])),
|
||||
$title
|
||||
);
|
||||
}
|
||||
|
||||
do_action('blocksy:hero:title:before');
|
||||
$elements[] = $title;
|
||||
do_action('blocksy:hero:title:after');
|
||||
|
||||
} 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(
|
||||
|
@ -90,21 +154,22 @@ global $post;
|
|||
]
|
||||
)
|
||||
);
|
||||
$description_element = '<div class="' . $description_class . '">' . get_the_archive_description() . '</div>';
|
||||
$elements[] = '<div class="' . $description_class . '">' . get_the_archive_description() . '</div>';
|
||||
} else if ($single_hero_element['id'] == 'breadcrumbs' && $single_hero_element['enabled']) {
|
||||
$breadcrumbs_builder = new Blocksy_Breadcrumbs_Builder();
|
||||
$elements[] = $breadcrumbs_builder->render();
|
||||
}
|
||||
}
|
||||
|
||||
$elements =
|
||||
$thumbnail_element .
|
||||
blocksy_render_view(
|
||||
get_template_directory() . '/inc/components/hero/elements.php', [ 'type' => 'type-1' ]
|
||||
) .
|
||||
$description_element;
|
||||
$html_elements = '';
|
||||
foreach ($elements as $element) {
|
||||
$html_elements .= $element;
|
||||
}
|
||||
|
||||
echo blocksy_output_hero_section([
|
||||
'type' => 'type-1',
|
||||
'source' => false,
|
||||
'elements' => $elements
|
||||
'elements' => $html_elements
|
||||
]);
|
||||
|
||||
?>
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
$page_container_classes = 'page type-page hentry singular';
|
||||
$page_container_classes = $page_container_classes . ( get_theme_mod('tainacan-repository-items_archive_filters_panel_background_style', 'boxed') == 'boxed' ? ' has-filters-panel-style-boxed' : '' );
|
||||
$page_container_classes = $page_container_classes . ( get_theme_mod('tainacan-repository-items_archive_page_header_background_style', 'boxed') == 'boxed' ? ' has-page-header-style-boxed' : '' );
|
||||
|
||||
$filters_panel_size = get_theme_mod('tainacan-repository-items_archive_filters_panel_size', '20%');
|
||||
$page_container_style = '--tainacan-filter-menu-width-theme:' . $filters_panel_size . ';';
|
||||
|
@ -44,7 +45,51 @@ $page_container_style .= 'background-color: var(--tainacan-background-color, #f8
|
|||
<header class="tainacan-collection-header">
|
||||
<div class="tainacan-collection-header__box">
|
||||
<?php
|
||||
echo blocksy_output_hero_section( 'type-1' );
|
||||
$hero_elements = get_theme_mod(
|
||||
'tainacan-repository-items_archive_hero_elements',
|
||||
[
|
||||
[
|
||||
'id' => 'custom_title',
|
||||
'enabled' => true,
|
||||
'heading_tag' => 'h1'
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
$elements = [];
|
||||
foreach ($hero_elements as $index => $single_hero_element) {
|
||||
if ($single_hero_element['id'] == 'custom_title' && $single_hero_element['enabled']) {
|
||||
$title = '';
|
||||
|
||||
if (! empty($title)) {
|
||||
$title = blocksy_html_tag(
|
||||
blocksy_akg('heading_tag', $single_hero_element, 'h1'),
|
||||
array_merge([
|
||||
'class' => 'page-title',
|
||||
], blocksy_schema_org_definitions('headline', [
|
||||
'array' => true
|
||||
])),
|
||||
$title
|
||||
);
|
||||
}
|
||||
|
||||
do_action('blocksy:hero:title:before');
|
||||
$elements[] = $title;
|
||||
do_action('blocksy:hero:title:after');
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$html_elements = '';
|
||||
foreach ($elements as $element) {
|
||||
$html_elements .= $element;
|
||||
}
|
||||
|
||||
echo blocksy_output_hero_section([
|
||||
'type' => 'type-1',
|
||||
'source' => false,
|
||||
'elements' => $html_elements
|
||||
]);
|
||||
?>
|
||||
</div>
|
||||
</header>
|
||||
|
|
|
@ -42,7 +42,7 @@ $current_term = tainacan_get_term();
|
|||
$current_taxonomy = get_taxonomy( $current_term->taxonomy );
|
||||
$current_term = \Tainacan\Repositories\Terms::get_instance()->fetch($current_term->term_id, $current_term->taxonomy);
|
||||
$image = $current_term->get_header_image_id();
|
||||
$src = wp_get_attachment_image_src($image, 'full');
|
||||
$thumbnail_src = wp_get_attachment_image_src($image, 'full');
|
||||
|
||||
?>
|
||||
|
||||
|
@ -53,34 +53,117 @@ $src = wp_get_attachment_image_src($image, 'full');
|
|||
<div class="tainacan-collection-header__box">
|
||||
<?php
|
||||
|
||||
$thumbnail_element = '';
|
||||
$is_thumbnail_enabled = false;
|
||||
$hero_elements = blocksy_akg_or_customizer(
|
||||
'hero_elements',
|
||||
[ 'prefix' => 'tainacan-terms-items_archive' ],
|
||||
[]
|
||||
$hero_elements = get_theme_mod(
|
||||
'tainacan-terms-items_archive_hero_elements',
|
||||
[
|
||||
[
|
||||
'id' => 'custom_thumbnail',
|
||||
'enabled' => true,
|
||||
],
|
||||
[
|
||||
'id' => 'custom_title',
|
||||
'enabled' => true,
|
||||
'heading_tag' => 'h1'
|
||||
],
|
||||
[
|
||||
'id' => 'breadcrumbs',
|
||||
'enabled' => true
|
||||
],
|
||||
[
|
||||
'id' => 'custom_description',
|
||||
'enabled' => true,
|
||||
'description_visibility' => [
|
||||
'desktop' => true,
|
||||
'tablet' => true,
|
||||
'mobile' => false,
|
||||
]
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
$elements = [];
|
||||
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 && $src && $src[0] ) {
|
||||
$thumbnail_element = '
|
||||
if ($single_hero_element['id'] == 'custom_thumbnail' && $single_hero_element['enabled'] && $thumbnail_src && $thumbnail_src[0]) {
|
||||
|
||||
$elements[] = '
|
||||
<div class="collection-thumbnail">
|
||||
<img src="' . $src[0] . '">
|
||||
<img src="' . $thumbnail_src[0] . '" alt="' . __('Term thumbnail', 'tainacan-blocksy') . '">
|
||||
</div>
|
||||
';
|
||||
} else if ($single_hero_element['id'] == 'custom_title' && $single_hero_element['enabled']) {
|
||||
$title = '';
|
||||
|
||||
$has_category_label = blocksy_akg(
|
||||
'has_category_label',
|
||||
$single_hero_element,
|
||||
'yes'
|
||||
);
|
||||
|
||||
if (! empty(get_the_archive_title())) {
|
||||
$title = wp_strip_all_tags(get_the_archive_title());
|
||||
|
||||
$divider_symbol = ':';
|
||||
|
||||
if (strpos($title, ':') !== false) {
|
||||
$divider_symbol = ':';
|
||||
}
|
||||
|
||||
$elements = $thumbnail_element . blocksy_render_view(
|
||||
get_template_directory() . '/inc/components/hero/elements.php', [ 'type' => 'type-1' ]
|
||||
if (strpos($title, $divider_symbol) !== false) {
|
||||
$title_pieces = explode($divider_symbol, $title, 2);
|
||||
|
||||
$title = '<span class="ct-title-label">' . $title_pieces[0] . '</span>' . $title_pieces[1];
|
||||
|
||||
if ($has_category_label !== 'yes') {
|
||||
$title = $title_pieces[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($title)) {
|
||||
$title = blocksy_html_tag(
|
||||
blocksy_akg('heading_tag', $single_hero_element, 'h1'),
|
||||
array_merge([
|
||||
'class' => 'page-title',
|
||||
], blocksy_schema_org_definitions('headline', [
|
||||
'array' => true
|
||||
])),
|
||||
$title
|
||||
);
|
||||
}
|
||||
|
||||
do_action('blocksy:hero:title:before');
|
||||
$elements[] = $title;
|
||||
do_action('blocksy:hero:title:after');
|
||||
|
||||
} 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,
|
||||
]
|
||||
)
|
||||
);
|
||||
$elements[] = '<div class="' . $description_class . '">' . get_the_archive_description() . '</div>';
|
||||
} else if ($single_hero_element['id'] == 'breadcrumbs' && $single_hero_element['enabled']) {
|
||||
$breadcrumbs_builder = new Blocksy_Breadcrumbs_Builder();
|
||||
$elements[] = $breadcrumbs_builder->render();
|
||||
}
|
||||
}
|
||||
|
||||
$html_elements = '';
|
||||
foreach ($elements as $element) {
|
||||
$html_elements .= $element;
|
||||
}
|
||||
|
||||
echo blocksy_output_hero_section([
|
||||
'type' => 'type-1',
|
||||
'source' => false,
|
||||
'elements' => $elements
|
||||
'elements' => $html_elements
|
||||
]);
|
||||
?>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue