Child theme vs plugin strategy.
This commit is contained in:
parent
53c3051525
commit
aa49315478
|
@ -0,0 +1,49 @@
|
||||||
|
# Blocksy Tainacan
|
||||||
|
|
||||||
|
## What's this about?
|
||||||
|
|
||||||
|
This project contains the source code necessary for integrating Tainacan pages to Blocksy theme. It allows you to choose betweent two strategies: either having a child theme or a plugin that does the job.
|
||||||
|
|
||||||
|
### But wait, what is Tainacan?
|
||||||
|
|
||||||
|
Tainacan is an open-source, flexible and powerful tool for creating digital repositories on WordPress. It allows you to create and manage collections with a variety of metadata types, rich search and filtering of items and much more. You can learn about it in our official website:
|
||||||
|
|
||||||
|
https://tainacan.org
|
||||||
|
|
||||||
|
### And how about Blocksy?
|
||||||
|
|
||||||
|
Blocksy is one of the many WordPress themes available outhere. But it is not just another theme, it offers rich controls to customize your site with so many features that you won't miss a page builder. This projects uses their customizer controls to offer options to set different layout settings to Tainacan pages such as the collection itens list and the items page.
|
||||||
|
|
||||||
|
## After all, a Child Theme or a Plugin?
|
||||||
|
|
||||||
|
While the most traditional strategy for creating themes compatible to Tainacan is to add some pages to the theme directly or using a child theme, this project offers another option, which is to use it as plugin. The reason is clear: developers might prefer to create child themes of Blocksy by their own, without creating forks of this project. It is althougt a not very canonical approach, so you might be more confortable using it as child theme.
|
||||||
|
|
||||||
|
## How to use it?
|
||||||
|
|
||||||
|
### As a child theme:
|
||||||
|
|
||||||
|
Just go to `functions.php` file and set the constant as you prefer:
|
||||||
|
|
||||||
|
```php
|
||||||
|
const BLOCKSY_TAINACAN_IS_PLUGIN = false;
|
||||||
|
```
|
||||||
|
|
||||||
|
Then move all files to a folder inside WordPress themes folder (`wp-content/themes`);
|
||||||
|
|
||||||
|
Donwload the parent theme Blocksy;
|
||||||
|
|
||||||
|
Go ahead, enable the child theme and have fun ;)
|
||||||
|
|
||||||
|
### As a plugin:
|
||||||
|
|
||||||
|
Just go to `functions.php` file and set the constant as you prefer:
|
||||||
|
|
||||||
|
```php
|
||||||
|
const BLOCKSY_TAINACAN_IS_PLUGIN = true;
|
||||||
|
```
|
||||||
|
|
||||||
|
Then move all files to a folder inside WordPress plugins folder (`wp-content/plugins`);
|
||||||
|
|
||||||
|
Donwload and activate the theme Blocksy;
|
||||||
|
|
||||||
|
Go ahead, enable Blocksy theme and have fun ;)
|
613
functions.php
613
functions.php
|
@ -1,599 +1,38 @@
|
||||||
<?php
|
<?php
|
||||||
|
/*
|
||||||
|
Plugin Name: Blocksy Tainacan
|
||||||
|
Plugin URI: https://tainacan.org/
|
||||||
|
Description: Tainacan support for Blocksy theme
|
||||||
|
Author: tainacan
|
||||||
|
Version: 0.1.0
|
||||||
|
Text Domain: blocksy-tainacan
|
||||||
|
License: GPLv2 or later
|
||||||
|
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
||||||
|
*/
|
||||||
|
|
||||||
if (! defined('WP_DEBUG') ) {
|
if (! defined('WP_DEBUG') ) {
|
||||||
die( 'Direct access forbidden.' );
|
die( 'Direct access forbidden.' );
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Theme version */
|
/** Theme/plugin version */
|
||||||
const BLOCKSY_TAINACAN_VERSION = '0.1.0';
|
const BLOCKSY_TAINACAN_VERSION = '0.1.0';
|
||||||
|
const BLOCKSY_TAINACAN_IS_PLUGIN = false;
|
||||||
|
|
||||||
/**
|
$plugin_root_url = BLOCKSY_TAINACAN_IS_PLUGIN ? plugin_dir_url(__FILE__) : get_stylesheet_directory_uri();
|
||||||
* Enqueue scripts and styles.
|
define('BLOCKSY_TAINACAN_PLUGIN_URL_PATH', $plugin_root_url);
|
||||||
*/
|
|
||||||
add_action( 'wp_enqueue_scripts', function () {
|
|
||||||
|
|
||||||
// First, we enqueue parent theme styles
|
$plugin_root_dir = BLOCKSY_TAINACAN_IS_PLUGIN ? plugin_dir_path(__FILE__) : get_stylesheet_directory() ;
|
||||||
wp_enqueue_style( 'blocksy-parent-style', get_template_directory_uri() . '/style.css' );
|
define('BLOCKSY_TAINACAN_PLUGIN_DIR_PATH', $plugin_root_dir);
|
||||||
|
|
||||||
// Then, this child theme styles
|
/* Basic styles and script enqueues */
|
||||||
wp_enqueue_style( 'tainacan-blocksy-style',
|
require BLOCKSY_TAINACAN_PLUGIN_DIR_PATH . '/inc/enqueues.php';
|
||||||
get_stylesheet_directory_uri() . '/style.min.css',
|
|
||||||
array( 'blocksy-parent-style' )
|
|
||||||
);
|
|
||||||
|
|
||||||
// Now, some dynamic css that is generated using blocksy dynamic css logic
|
/* Template redirection necessary only if in a plugin */
|
||||||
add_action('blocksy:global-dynamic-css:enqueue', function ($args) {
|
if ( BLOCKSY_TAINACAN_IS_PLUGIN ) {
|
||||||
blocksy_theme_get_dynamic_styles(array_merge([
|
require BLOCKSY_TAINACAN_PLUGIN_DIR_PATH . '/inc/plugin.php';
|
||||||
'path' => get_stylesheet_directory() . '/inc/global.php',
|
|
||||||
'chunk' => 'global',
|
|
||||||
'forced_call' => true
|
|
||||||
], $args));
|
|
||||||
}, 10, 3);
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Retrieves an item adjacent link, either using WP strategy or Tainacan plugin tainacan_get_adjacent_items()
|
|
||||||
*/
|
|
||||||
function blocksy_tainacan_get_adjacent_item_links() {
|
|
||||||
|
|
||||||
$prefix = blocksy_manager()->screen->get_prefix();
|
|
||||||
|
|
||||||
// We use Tainacan own method for obtaining previous and next item objects
|
|
||||||
if (function_exists('tainacan_get_adjacent_items') && isset($_GET['pos'])) {
|
|
||||||
$adjacent_items = tainacan_get_adjacent_items();
|
|
||||||
|
|
||||||
if (isset($adjacent_items['next'])) {
|
|
||||||
$next_link_url = $adjacent_items['next']['url'];
|
|
||||||
$next_title = $adjacent_items['next']['title'];
|
|
||||||
} else {
|
|
||||||
$next_link_url = false;
|
|
||||||
}
|
|
||||||
if (isset($adjacent_items['previous'])) {
|
|
||||||
$previous_link_url = $adjacent_items['previous']['url'];
|
|
||||||
$previous_title = $adjacent_items['previous']['title'];
|
|
||||||
} else {
|
|
||||||
$previous_link_url = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
/* Requires several settings, functions and helpers */
|
||||||
//Get the links to the Previous and Next Post
|
require BLOCKSY_TAINACAN_PLUGIN_DIR_PATH . '/inc/integration.php';
|
||||||
$previous_link_url = get_permalink( get_previous_post() );
|
require BLOCKSY_TAINACAN_PLUGIN_DIR_PATH . '/inc/customizer.php';
|
||||||
$next_link_url = get_permalink( get_next_post() );
|
require BLOCKSY_TAINACAN_PLUGIN_DIR_PATH . '/inc/navigation.php';
|
||||||
|
|
||||||
//Get the title of the previous post and next post
|
|
||||||
$previous_title = get_the_title( get_previous_post() );
|
|
||||||
$next_title = get_the_title( get_next_post() );
|
|
||||||
}
|
|
||||||
|
|
||||||
// Then we obtain blocksy settings
|
|
||||||
$has_thumb = get_theme_mod($prefix . '_has_post_nav_thumb', 'yes') === 'yes';
|
|
||||||
|
|
||||||
$has_title = get_theme_mod($prefix . '_has_post_nav_title', 'yes') === 'yes';
|
|
||||||
|
|
||||||
$previous = '';
|
|
||||||
$next = '';
|
|
||||||
|
|
||||||
if ($has_thumb) {
|
|
||||||
|
|
||||||
if (function_exists('tainacan_get_adjacent_items') && isset($_GET['pos'])) {
|
|
||||||
if ($adjacent_items['next']) {
|
|
||||||
$next_thumb = $adjacent_items['next']['thumbnail']['tainacan-medium'][0];
|
|
||||||
}
|
|
||||||
if ($adjacent_items['previous']) {
|
|
||||||
$previous_thumb = $adjacent_items['previous']['thumbnail']['tainacan-medium'][0];
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
//Get the thumnail url of the previous and next post
|
|
||||||
$previous_thumb = get_the_post_thumbnail_url( get_previous_post(), 'tainacan-medium' );
|
|
||||||
$next_thumb = get_the_post_thumbnail_url( get_next_post(), 'tainacan-medium' );
|
|
||||||
}
|
|
||||||
|
|
||||||
$previous_post_image_output = blocksy_simple_image(
|
|
||||||
$previous_thumb,
|
|
||||||
[
|
|
||||||
'inner_content' => '<svg width="20px" height="15px" viewBox="0 0 20 15"><polygon points="0,7.5 5.5,13 6.4,12.1 2.4,8.1 20,8.1 20,6.9 2.4,6.9 6.4,2.9 5.5,2 "/></svg>',
|
|
||||||
'ratio' => '1/1',
|
|
||||||
'tag_name' => 'figure'
|
|
||||||
]
|
|
||||||
);
|
|
||||||
|
|
||||||
$next_post_image_output = blocksy_simple_image(
|
|
||||||
$next_thumb,
|
|
||||||
[
|
|
||||||
'inner_content' => '<svg width="20px" height="15px" viewBox="0 0 20 15"><polygon points="14.5,2 13.6,2.9 17.6,6.9 0,6.9 0,8.1 17.6,8.1 13.6,12.1 14.5,13 20,7.5 "/></svg>',
|
|
||||||
'ratio' => '1/1',
|
|
||||||
'tag_name' => 'figure'
|
|
||||||
]
|
|
||||||
);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Creates the links
|
|
||||||
$previous = $previous_link_url === false ? '' : (
|
|
||||||
'<a href="' . $previous_link_url .'" rel="prev" class="nav-item-prev"> ' .
|
|
||||||
($has_thumb ? $previous_post_image_output : '') .
|
|
||||||
'<div class="item-content">' .
|
|
||||||
'<span class="item-label">' . __( 'Previous item', 'blocksy-tainacan' ) . '</span>' .
|
|
||||||
(( !empty( $previous_title ) && $has_title ) ? ('<span class="item-title">' . $previous_title . '</span>') : '') .
|
|
||||||
'</div>'.
|
|
||||||
'</a>');
|
|
||||||
|
|
||||||
$next = $next_link_url === false ? '' : (
|
|
||||||
'<a href="' . $next_link_url .'" rel="prev" class="nav-item-next"> ' .
|
|
||||||
'<div class="item-content">' .
|
|
||||||
'<span class="item-label">' . __( 'Next item', 'blocksy-tainacan') . '</span>' .
|
|
||||||
(( !empty( $next_title ) && $has_title) ? ('<span class="item-title">' . $next_title . '</span>') : '') .
|
|
||||||
'</div>' .
|
|
||||||
($has_thumb ? $next_post_image_output : '') .
|
|
||||||
'</a>');
|
|
||||||
|
|
||||||
return ['next' => $next, 'previous' => $previous];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Copy of blocksy original post navigation function.
|
|
||||||
* Check inc/template-tags.php post navigation file on the parent theme
|
|
||||||
*/
|
|
||||||
function blocksy_default_post_navigation() {
|
|
||||||
$next_post = apply_filters(
|
|
||||||
'blocksy:post-navigation:next-post',
|
|
||||||
get_adjacent_post(false, '', true)
|
|
||||||
);
|
|
||||||
|
|
||||||
$previous_post = apply_filters(
|
|
||||||
'blocksy:post-navigation:previous-post',
|
|
||||||
get_adjacent_post(false, '', false)
|
|
||||||
);
|
|
||||||
|
|
||||||
if (! $next_post && ! $previous_post) {
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
$prefix = blocksy_manager()->screen->get_prefix();
|
|
||||||
|
|
||||||
$container_class = 'post-navigation';
|
|
||||||
|
|
||||||
$container_class .= ' ' . blocksy_visibility_classes(get_theme_mod(
|
|
||||||
$prefix . '_post_nav_visibility',
|
|
||||||
[
|
|
||||||
'desktop' => true,
|
|
||||||
'tablet' => true,
|
|
||||||
'mobile' => true,
|
|
||||||
]
|
|
||||||
));
|
|
||||||
|
|
||||||
$home_page_url = get_home_url();
|
|
||||||
|
|
||||||
$post_slug = get_post_type() === 'post' ? __( 'Post', 'blocksy' ) : get_post_type_object( get_post_type() )->labels->singular_name;
|
|
||||||
$post_slug = '<span>' . $post_slug . '</span>';
|
|
||||||
|
|
||||||
$has_thumb = get_theme_mod($prefix . '_has_post_nav_thumb', 'yes') === 'yes';
|
|
||||||
|
|
||||||
$has_title = get_theme_mod($prefix . '_has_post_nav_title', 'yes') === 'yes';
|
|
||||||
|
|
||||||
$next_post_image_output = '';
|
|
||||||
$previous_post_image_output = '';
|
|
||||||
|
|
||||||
if ($next_post) {
|
|
||||||
$next_title = '';
|
|
||||||
|
|
||||||
if ($has_title) {
|
|
||||||
$next_title = $next_post->post_title;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($has_thumb && get_post_thumbnail_id($next_post)) {
|
|
||||||
$next_post_image_output = blocksy_image(
|
|
||||||
[
|
|
||||||
'attachment_id' => get_post_thumbnail_id( $next_post ),
|
|
||||||
'ratio' => '1/1',
|
|
||||||
'inner_content' => '<svg width="20px" height="15px" viewBox="0 0 20 15"><polygon points="0,7.5 5.5,13 6.4,12.1 2.4,8.1 20,8.1 20,6.9 2.4,6.9 6.4,2.9 5.5,2 "/></svg>',
|
|
||||||
'tag_name' => 'figure'
|
|
||||||
]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($previous_post) {
|
|
||||||
$previous_title = '';
|
|
||||||
if ( $has_title ) {
|
|
||||||
$previous_title = $previous_post->post_title;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($has_thumb && get_post_thumbnail_id($previous_post)) {
|
|
||||||
$previous_post_image_output = blocksy_image(
|
|
||||||
[
|
|
||||||
'attachment_id' => get_post_thumbnail_id( $previous_post ),
|
|
||||||
'ratio' => '1/1',
|
|
||||||
'inner_content' => '<svg width="20px" height="15px" viewBox="0 0 20 15"><polygon points="14.5,2 13.6,2.9 17.6,6.9 0,6.9 0,8.1 17.6,8.1 13.6,12.1 14.5,13 20,7.5 "/></svg>',
|
|
||||||
'tag_name' => 'figure'
|
|
||||||
]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ob_start();
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
<nav class="<?php echo esc_attr( $container_class ); ?>">
|
|
||||||
<?php if ($next_post) { ?>
|
|
||||||
<a href="<?php echo esc_url(get_permalink($next_post)); ?>" class="nav-item-prev">
|
|
||||||
<?php if ($has_thumb) { ?>
|
|
||||||
<?php
|
|
||||||
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
|
||||||
echo $next_post_image_output;
|
|
||||||
?>
|
|
||||||
<?php } ?>
|
|
||||||
|
|
||||||
<div class="item-content">
|
|
||||||
<span class="item-label">
|
|
||||||
<?php
|
|
||||||
echo wp_kses_post(sprintf(
|
|
||||||
// translators: post title
|
|
||||||
__( 'Previous %s', 'blocksy' ),
|
|
||||||
$post_slug
|
|
||||||
));
|
|
||||||
?>
|
|
||||||
</span>
|
|
||||||
|
|
||||||
<?php if ( ! empty( $next_title ) ) { ?>
|
|
||||||
<span class="item-title">
|
|
||||||
<?php echo wp_kses_post($next_title); ?>
|
|
||||||
</span>
|
|
||||||
<?php } ?>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</a>
|
|
||||||
<?php } else { ?>
|
|
||||||
<div class="nav-item-prev"></div>
|
|
||||||
<?php } ?>
|
|
||||||
|
|
||||||
<?php if ( $previous_post ) { ?>
|
|
||||||
<a href="<?php echo esc_url( get_permalink( $previous_post ) ); ?>" class="nav-item-next">
|
|
||||||
<div class="item-content">
|
|
||||||
<span class="item-label">
|
|
||||||
<?php
|
|
||||||
echo wp_kses_post(sprintf(
|
|
||||||
// translators: post title
|
|
||||||
__( 'Next %s', 'blocksy' ),
|
|
||||||
$post_slug
|
|
||||||
));
|
|
||||||
?>
|
|
||||||
</span>
|
|
||||||
|
|
||||||
<?php if ( ! empty( $previous_title ) ) { ?>
|
|
||||||
<span class="item-title">
|
|
||||||
<?php echo wp_kses_post($previous_title); ?>
|
|
||||||
</span>
|
|
||||||
<?php } ?>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<?php if ($has_thumb) { ?>
|
|
||||||
<?php
|
|
||||||
echo $previous_post_image_output;
|
|
||||||
?>
|
|
||||||
<?php } ?>
|
|
||||||
</a>
|
|
||||||
<?php } else { ?>
|
|
||||||
<div class="nav-item-next"></div>
|
|
||||||
<?php } ?>
|
|
||||||
|
|
||||||
</nav>
|
|
||||||
|
|
||||||
<?php
|
|
||||||
|
|
||||||
return ob_get_clean();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Outputs Tainacan custom logic for items navigation with blocksy features
|
|
||||||
*/
|
|
||||||
function blocksy_tainacan_item_navigation() {
|
|
||||||
$next = '';
|
|
||||||
$previous = '';
|
|
||||||
$prefix = blocksy_manager()->screen->get_prefix();
|
|
||||||
|
|
||||||
if (get_theme_mod( $prefix . '_has_post_nav', $prefix === 'single_blog_post' ? 'yes' : 'no' ) === 'yes') {
|
|
||||||
|
|
||||||
$container_class = 'post-navigation';
|
|
||||||
|
|
||||||
$container_class .= ' ' . blocksy_visibility_classes(get_theme_mod(
|
|
||||||
$prefix . '_post_nav_visibility',
|
|
||||||
[
|
|
||||||
'desktop' => true,
|
|
||||||
'tablet' => true,
|
|
||||||
'mobile' => true,
|
|
||||||
]
|
|
||||||
));
|
|
||||||
|
|
||||||
$has_thumb = get_theme_mod($prefix . '_has_post_nav_thumb', 'yes') === 'yes';
|
|
||||||
|
|
||||||
if ($has_thumb)
|
|
||||||
$container_class .= ' has-thumbnails';
|
|
||||||
|
|
||||||
$adjacent_links = [
|
|
||||||
'next' => '',
|
|
||||||
'previous' => ''
|
|
||||||
];
|
|
||||||
|
|
||||||
$adjacent_links = blocksy_tainacan_get_adjacent_item_links();
|
|
||||||
|
|
||||||
$previous = $adjacent_links['previous'];
|
|
||||||
$next = $adjacent_links['next'];
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
||||||
<?php if ($previous !== '' || $next !== '') : ?>
|
|
||||||
<nav class="<?php echo esc_attr( $container_class ); ?>">
|
|
||||||
<?php if ( $previous !== '' ) {
|
|
||||||
echo $previous;
|
|
||||||
} else { ?>
|
|
||||||
<div class="nav-item-prev"></div>
|
|
||||||
<?php } ?>
|
|
||||||
|
|
||||||
<?php if ( $next !== '' ) {
|
|
||||||
echo $next;
|
|
||||||
} else { ?>
|
|
||||||
<div class="nav-item-next"></div>
|
|
||||||
<?php } ?>
|
|
||||||
</nav>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Overrides parent theme blocksy post navigation logic to handle items navigation
|
|
||||||
*/
|
|
||||||
function blocksy_post_navigation() {
|
|
||||||
|
|
||||||
// This should only happen if we have Tainacan plugin installed
|
|
||||||
if ( defined ('TAINACAN_VERSION') ) {
|
|
||||||
$collections_post_types = \Tainacan\Repositories\Repository::get_collections_db_identifiers();
|
|
||||||
$post_type = get_post_type();
|
|
||||||
|
|
||||||
// Check if we're inside the main loop in a single Post.
|
|
||||||
if (in_array($post_type, $collections_post_types) && is_singular() && in_the_loop() && is_main_query() ) {
|
|
||||||
return blocksy_tainacan_item_navigation();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return blocksy_default_post_navigation();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Uses Blocksy filter to customize the related posts logic on Tainacan Items page. (NOT IN USE YET)
|
|
||||||
*/
|
|
||||||
function blocksy_tainacan_custom_related_posts_query( $related_posts_query ) {
|
|
||||||
|
|
||||||
// This should only happen if we have Tainacan plugin installed
|
|
||||||
if ( defined ('TAINACAN_VERSION') ) {
|
|
||||||
$collections_post_types = \Tainacan\Repositories\Repository::get_collections_db_identifiers();
|
|
||||||
$post_type = get_post_type();
|
|
||||||
|
|
||||||
// Check if we're inside the main loop in a single Post.
|
|
||||||
if (in_array($post_type, $collections_post_types) && is_singular() && in_the_loop() && is_main_query() ) {
|
|
||||||
// In the future, we might update the related_post_query here for Tainacan items.
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $related_posts_query;
|
|
||||||
}
|
|
||||||
//add_filter( 'blocksy:related-posts:query-args', 'blocksy_tainacan_custom_related_posts_query', 10 );
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Uses Blocksy filter to add custom link on the item breadcrumb
|
|
||||||
*/
|
|
||||||
function blocksy_tainacan_custom_breadcrumbs( $array ) {
|
|
||||||
|
|
||||||
// This should only happen if we have Tainacan plugin installed
|
|
||||||
if ( defined ('TAINACAN_VERSION') ) {
|
|
||||||
$collections_post_types = \Tainacan\Repositories\Repository::get_collections_db_identifiers();
|
|
||||||
$post_type = get_post_type();
|
|
||||||
|
|
||||||
// Check if we're inside the main loop in a single Post.
|
|
||||||
if (in_array($post_type, $collections_post_types) && is_singular() && in_the_loop() && is_main_query() ) {
|
|
||||||
$args = $_GET;
|
|
||||||
|
|
||||||
for ($i = 0; $i < count($array); $i++) {
|
|
||||||
|
|
||||||
// Check if the current thumbnail links to the collection, then enriches its URL
|
|
||||||
if (
|
|
||||||
isset($array[$i]['url']) &&
|
|
||||||
isset($args['ref']) &&
|
|
||||||
substr($array[$i]['url'], -strlen($args['ref']))===$args['ref']
|
|
||||||
) {
|
|
||||||
$ref = $args['ref'];
|
|
||||||
unset($args['pos']);
|
|
||||||
unset($args['ref']);
|
|
||||||
unset($args['source_list']);
|
|
||||||
$array[$i]['url'] = $ref . '?' . http_build_query(array_merge($args));
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $array;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $array;
|
|
||||||
}
|
|
||||||
add_filter( 'blocksy:breadcrumbs:items-array', 'blocksy_tainacan_custom_breadcrumbs', 10, 3 );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds extra customizer options to items single page template
|
|
||||||
*/
|
|
||||||
function blocksy_tainacan_custom_post_types_single_options( $options, $post_type, $post_type_object ) {
|
|
||||||
|
|
||||||
// This should only happen if we have Tainacan plugin installed
|
|
||||||
if ( defined ('TAINACAN_VERSION') ) {
|
|
||||||
$collections_post_types = \Tainacan\Repositories\Repository::get_collections_db_identifiers();
|
|
||||||
|
|
||||||
if ( in_array($post_type, $collections_post_types) ) {
|
|
||||||
|
|
||||||
// Change the section title in the customizer
|
|
||||||
$options['title'] = sprintf(
|
|
||||||
__('Item from %s', 'blocksy-tainacan'),
|
|
||||||
$post_type_object->labels->name
|
|
||||||
);
|
|
||||||
|
|
||||||
// Extra options to the single item template
|
|
||||||
$item_extra_options = blocksy_get_options(get_stylesheet_directory() . '/inc/options/posts/tainacan-item-single.php', [
|
|
||||||
'post_type' => $post_type_object,
|
|
||||||
'is_general_cpt' => true
|
|
||||||
], false);
|
|
||||||
|
|
||||||
if ( is_array($item_extra_options) ) {
|
|
||||||
array_splice(
|
|
||||||
$options['options'][$post_type . '_single_section_options']['inner-options'][0],
|
|
||||||
1,
|
|
||||||
0,
|
|
||||||
$item_extra_options
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return $options;
|
|
||||||
}
|
|
||||||
add_filter( 'blocksy:custom_post_types:single-options', 'blocksy_tainacan_custom_post_types_single_options', 10, 3 );
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds extra customizer options to items single page template
|
|
||||||
*/
|
|
||||||
function blocksy_tainacan_custom_post_types_archive_options( $options, $post_type, $post_type_object ) {
|
|
||||||
|
|
||||||
// This should only happen if we have Tainacan plugin installed
|
|
||||||
if ( defined ('TAINACAN_VERSION') ) {
|
|
||||||
$collections_post_types = \Tainacan\Repositories\Repository::get_collections_db_identifiers();
|
|
||||||
|
|
||||||
if ( in_array($post_type, $collections_post_types) ) {
|
|
||||||
|
|
||||||
// Change the section title in the customizer
|
|
||||||
$options['title'] = sprintf(
|
|
||||||
__('Items list from %s', 'blocksy-tainacan'),
|
|
||||||
$post_type_object->labels->name
|
|
||||||
);
|
|
||||||
|
|
||||||
// Extra options to the archive items list
|
|
||||||
$items_extra_options = blocksy_get_options(get_stylesheet_directory() . '/inc/options/posts/tainacan-item-archive.php', [
|
|
||||||
'post_type' => $post_type_object,
|
|
||||||
'is_general_cpt' => true
|
|
||||||
], false);
|
|
||||||
|
|
||||||
if ( is_array($items_extra_options) ) {
|
|
||||||
$options['options'][$post_type . '_section_options']['inner-options'] = $items_extra_options;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $options;
|
|
||||||
}
|
|
||||||
add_filter( 'blocksy:custom_post_types:archive-options', 'blocksy_tainacan_custom_post_types_archive_options', 10, 3 );
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Removes tainacan metadatum and filters from the custom metadata options in the customizer controller.
|
|
||||||
*/
|
|
||||||
function blocksy_tainacan_custom_post_types_supported_list( $potential_post_types ) {
|
|
||||||
|
|
||||||
// This should only happen if we have Tainacan plugin installed
|
|
||||||
if ( defined ('TAINACAN_VERSION') ) {
|
|
||||||
return array_filter( $potential_post_types, function($post_type) {
|
|
||||||
return !in_array($post_type, [ 'tainacan-metadatum', 'tainacan-filter' ]);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return $potential_post_types;
|
|
||||||
}
|
|
||||||
add_filter( 'blocksy:custom_post_types:supported_list', 'blocksy_tainacan_custom_post_types_supported_list', 10 );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Renders the item single page with a custom template that will use most of Blocksy features
|
|
||||||
*/
|
|
||||||
function filter_the_content_in_the_main_loop( $content ) {
|
|
||||||
|
|
||||||
// This should only happen if we have Tainacan plugin installed
|
|
||||||
if ( defined ('TAINACAN_VERSION') ) {
|
|
||||||
$collections_post_types = \Tainacan\Repositories\Repository::get_collections_db_identifiers();
|
|
||||||
$post_type = get_post_type();
|
|
||||||
|
|
||||||
// Check if we're inside the main loop in a single Post.
|
|
||||||
if (in_array($post_type, $collections_post_types) && is_singular() && in_the_loop() && is_main_query() ) {
|
|
||||||
return get_template_part( 'tainacan/item-single-page' );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $content;
|
|
||||||
}
|
|
||||||
add_filter( 'the_content', 'filter_the_content_in_the_main_loop');
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Enqueues js general scripts and those related to swiper, only if in TainacanSingleItem pages
|
|
||||||
*/
|
|
||||||
function blocksy_tainacan_enqueue_scripts() {
|
|
||||||
|
|
||||||
// This should only happen if we have Tainacan plugin installed
|
|
||||||
if ( defined ('TAINACAN_VERSION') ) {
|
|
||||||
$collections_post_types = \Tainacan\Repositories\Repository::get_collections_db_identifiers();
|
|
||||||
$post_type = get_post_type();
|
|
||||||
|
|
||||||
if ( in_array($post_type, $collections_post_types) ) {
|
|
||||||
wp_enqueue_style( 'swiper', 'https://unpkg.com/swiper/swiper-bundle.min.css', array(), BLOCKSY_TAINACAN_VERSION );
|
|
||||||
wp_enqueue_script( 'swiper', 'https://unpkg.com/swiper/swiper-bundle.min.js', array(), BLOCKSY_TAINACAN_VERSION, true );
|
|
||||||
wp_enqueue_style( 'photoswipe', 'https://cdnjs.cloudflare.com/ajax/libs/photoswipe/4.1.3/photoswipe.min.css', array(), BLOCKSY_TAINACAN_VERSION );
|
|
||||||
wp_enqueue_style( 'photoswipe-skin', 'https://cdnjs.cloudflare.com/ajax/libs/photoswipe/4.1.3/default-skin/default-skin.min.css', array(), BLOCKSY_TAINACAN_VERSION );
|
|
||||||
wp_enqueue_script( 'photoswipe', 'https://cdnjs.cloudflare.com/ajax/libs/photoswipe/4.1.3/photoswipe.min.js', array(), BLOCKSY_TAINACAN_VERSION, true );
|
|
||||||
wp_enqueue_script( 'photoswipe-skin', 'https://cdnjs.cloudflare.com/ajax/libs/photoswipe/4.1.3/photoswipe-ui-default.min.js', array(), BLOCKSY_TAINACAN_VERSION, true );
|
|
||||||
wp_enqueue_script( 'blocksy-tainacan-scripts__swiper', get_stylesheet_directory_uri() . '/js/attachments-carousel.js', ['swiper', 'photoswipe', 'photoswipe-skin'], BLOCKSY_TAINACAN_VERSION, true );
|
|
||||||
}
|
|
||||||
|
|
||||||
wp_enqueue_script( 'blocksy-tainacan-scripts', get_stylesheet_directory_uri() . '/js/scripts.js', [], BLOCKSY_TAINACAN_VERSION, true );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
add_action( 'wp_enqueue_scripts', 'blocksy_tainacan_enqueue_scripts' );
|
|
||||||
|
|
||||||
/* Requires helpers */
|
|
||||||
require get_stylesheet_directory() . '/helpers/blocksy-integration.php';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Enqueues front-end CSS for the items page fixed filters logic.
|
|
||||||
*
|
|
||||||
* @see wp_add_inline_style()
|
|
||||||
*/
|
|
||||||
function blocksy_tainacan_items_page_filters_fixed_on_scroll_output() {
|
|
||||||
$prefix = blocksy_manager()->screen->get_prefix();
|
|
||||||
|
|
||||||
$should_use_fixed_filters_logic = (version_compare(TAINACAN_VERSION, '0.17') >= 0) && get_theme_mod( $prefix . '_filters_fixed_on_scroll', 'no' ) == 'yes';
|
|
||||||
|
|
||||||
if (!$should_use_fixed_filters_logic)
|
|
||||||
return;
|
|
||||||
|
|
||||||
$css = '
|
|
||||||
/* Items list fixed filter logic (Introduced in Tainacan 0.17) */
|
|
||||||
:not(.wp-block-tainacan-faceted-search)>.theme-items-list:not(.is-fullscreen).is-filters-menu-open.is-filters-menu-fixed-at-top .items-list-area {
|
|
||||||
margin-left: var(--tainacan-filter-menu-width-theme) !important;
|
|
||||||
}
|
|
||||||
:not(.wp-block-tainacan-faceted-search)>.theme-items-list:not(.is-fullscreen).is-filters-menu-open.is-filters-menu-fixed-at-top .filters-menu:not(.filters-menu-modal) {
|
|
||||||
position: fixed;
|
|
||||||
top: 0px !important;
|
|
||||||
z-index: 9;
|
|
||||||
}
|
|
||||||
:not(.wp-block-tainacan-faceted-search)>.theme-items-list:not(.is-fullscreen).is-filters-menu-open.is-filters-menu-fixed-at-top .filters-menu:not(.filters-menu-modal) .modal-content {
|
|
||||||
position: absolute;
|
|
||||||
top: 0px;
|
|
||||||
height: auto !important;
|
|
||||||
background: var(--tainacan-background-color, inherit);
|
|
||||||
}
|
|
||||||
:not(.wp-block-tainacan-faceted-search)>.theme-items-list:not(.is-fullscreen).is-filters-menu-open.is-filters-menu-fixed-at-top.is-filters-menu-fixed-at-bottom .filters-menu:not(.filters-menu-modal) {
|
|
||||||
position: absolute;
|
|
||||||
}
|
|
||||||
:not(.wp-block-tainacan-faceted-search)>.theme-items-list:not(.is-fullscreen).is-filters-menu-open.is-filters-menu-fixed-at-top.is-filters-menu-fixed-at-bottom .filters-menu:not(.filters-menu-modal) .modal-content {
|
|
||||||
top: auto;
|
|
||||||
bottom: 0;
|
|
||||||
}
|
|
||||||
';
|
|
||||||
echo '<style type="text/css" id="tainacan-fixed-filters-style">' . sprintf( $css ) . '</style>';
|
|
||||||
|
|
||||||
}
|
|
||||||
add_action( 'wp_head', 'blocksy_tainacan_items_page_filters_fixed_on_scroll_output');
|
|
||||||
|
|
|
@ -0,0 +1,160 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds Tainacan repository and term items list to settings on customizer.
|
||||||
|
*/
|
||||||
|
if ( !function_exists('blocksy_tainacan_add_repository_and_terms_items_options_panel') ) {
|
||||||
|
function blocksy_tainacan_add_repository_and_terms_items_options_panel($options) {
|
||||||
|
|
||||||
|
$options['tainacan_repository_items_list'] = blc_call_fn(
|
||||||
|
[
|
||||||
|
'fn' => 'blocksy_get_options',
|
||||||
|
'default' => 'array'
|
||||||
|
],
|
||||||
|
BLOCKSY_TAINACAN_PLUGIN_DIR_PATH . '/inc/options/archives/tainacan-repository-items.php',
|
||||||
|
[], false
|
||||||
|
);
|
||||||
|
|
||||||
|
return $options;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
add_filter( 'blocksy_extensions_customizer_options', 'blocksy_tainacan_add_repository_and_terms_items_options_panel' );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds Tainacan terms and term items list to settings on customizer.
|
||||||
|
*/
|
||||||
|
if ( !function_exists('blocksy_tainacan_add_terms_and_terms_items_options_panel') ) {
|
||||||
|
function blocksy_tainacan_add_terms_and_terms_items_options_panel($options) {
|
||||||
|
|
||||||
|
$options['tainacan_terms_items_list'] = blc_call_fn(
|
||||||
|
[
|
||||||
|
'fn' => 'blocksy_get_options',
|
||||||
|
'default' => 'array'
|
||||||
|
],
|
||||||
|
BLOCKSY_TAINACAN_PLUGIN_DIR_PATH . '/inc/options/archives/tainacan-terms-items.php',
|
||||||
|
[], false
|
||||||
|
);
|
||||||
|
|
||||||
|
return $options;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
add_filter( 'blocksy_extensions_customizer_options', 'blocksy_tainacan_add_terms_and_terms_items_options_panel' );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds extra customizer options to items single page template
|
||||||
|
*/
|
||||||
|
if ( !function_exists('blocksy_tainacan_custom_post_types_single_options') ) {
|
||||||
|
function blocksy_tainacan_custom_post_types_single_options( $options, $post_type, $post_type_object ) {
|
||||||
|
|
||||||
|
// This should only happen if we have Tainacan plugin installed
|
||||||
|
if ( defined ('TAINACAN_VERSION') ) {
|
||||||
|
$collections_post_types = \Tainacan\Repositories\Repository::get_collections_db_identifiers();
|
||||||
|
|
||||||
|
if ( in_array($post_type, $collections_post_types) ) {
|
||||||
|
|
||||||
|
// Change the section title in the customizer
|
||||||
|
$options['title'] = sprintf(
|
||||||
|
__('Item from %s', 'blocksy-tainacan'),
|
||||||
|
$post_type_object->labels->name
|
||||||
|
);
|
||||||
|
|
||||||
|
// Extra options to the single item template
|
||||||
|
$item_extra_options = blocksy_get_options(BLOCKSY_TAINACAN_PLUGIN_DIR_PATH . '/inc/options/posts/tainacan-item-single.php', [
|
||||||
|
'post_type' => $post_type_object,
|
||||||
|
'is_general_cpt' => true
|
||||||
|
], false);
|
||||||
|
|
||||||
|
if ( is_array($item_extra_options) ) {
|
||||||
|
array_splice(
|
||||||
|
$options['options'][$post_type . '_single_section_options']['inner-options'][0],
|
||||||
|
1,
|
||||||
|
0,
|
||||||
|
$item_extra_options
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return $options;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
add_filter( 'blocksy:custom_post_types:single-options', 'blocksy_tainacan_custom_post_types_single_options', 10, 3 );
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds extra customizer options to items single page template
|
||||||
|
*/
|
||||||
|
if ( !function_exists('blocksy_tainacan_custom_post_types_archive_options') ) {
|
||||||
|
function blocksy_tainacan_custom_post_types_archive_options( $options, $post_type, $post_type_object ) {
|
||||||
|
|
||||||
|
// This should only happen if we have Tainacan plugin installed
|
||||||
|
if ( defined ('TAINACAN_VERSION') ) {
|
||||||
|
$collections_post_types = \Tainacan\Repositories\Repository::get_collections_db_identifiers();
|
||||||
|
|
||||||
|
if ( in_array($post_type, $collections_post_types) ) {
|
||||||
|
|
||||||
|
// Change the section title in the customizer
|
||||||
|
$options['title'] = sprintf(
|
||||||
|
__('Items list from %s', 'blocksy-tainacan'),
|
||||||
|
$post_type_object->labels->name
|
||||||
|
);
|
||||||
|
|
||||||
|
// Extra options to the archive items list
|
||||||
|
$items_extra_options = blocksy_get_options(BLOCKSY_TAINACAN_PLUGIN_DIR_PATH . '/inc/options/posts/tainacan-item-archive.php', [
|
||||||
|
'prefix' => $post_type_object->name,
|
||||||
|
'is_general_cpt' => true
|
||||||
|
], false);
|
||||||
|
|
||||||
|
if ( is_array($items_extra_options) ) {
|
||||||
|
$options['options'][$post_type . '_section_options']['inner-options'] = $items_extra_options;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $options;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
add_filter( 'blocksy:custom_post_types:archive-options', 'blocksy_tainacan_custom_post_types_archive_options', 10, 3 );
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes tainacan metadatum and filters from the custom metadata options in the customizer controller.
|
||||||
|
*/
|
||||||
|
if ( !function_exists('blocksy_tainacan_custom_post_types_supported_list') ) {
|
||||||
|
function blocksy_tainacan_custom_post_types_supported_list( $potential_post_types ) {
|
||||||
|
|
||||||
|
// This should only happen if we have Tainacan plugin installed
|
||||||
|
if ( defined ('TAINACAN_VERSION') ) {
|
||||||
|
return array_filter( $potential_post_types, function($post_type) {
|
||||||
|
return !in_array($post_type, [ 'tainacan-metadatum', 'tainacan-filter' ]);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return $potential_post_types;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
add_filter( 'blocksy:custom_post_types:supported_list', 'blocksy_tainacan_custom_post_types_supported_list', 10 );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renders the item single page with a custom template that will use most of Blocksy features
|
||||||
|
*/
|
||||||
|
if ( !function_exists('blocksy_tainacan_the_content_for_items') ) {
|
||||||
|
function blocksy_tainacan_the_content_for_items( $content ) {
|
||||||
|
|
||||||
|
// This should only happen if we have Tainacan plugin installed
|
||||||
|
if ( defined ('TAINACAN_VERSION') ) {
|
||||||
|
$collections_post_types = \Tainacan\Repositories\Repository::get_collections_db_identifiers();
|
||||||
|
$post_type = get_post_type();
|
||||||
|
|
||||||
|
// Check if we're inside the main loop in a single Post.
|
||||||
|
if (in_array($post_type, $collections_post_types) && is_singular() && in_the_loop() && is_main_query() ) {
|
||||||
|
return get_template_part( 'tainacan/item-single-page' );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $content;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
add_filter( 'the_content', 'blocksy_tainacan_the_content_for_items');
|
||||||
|
|
||||||
|
?>
|
|
@ -0,0 +1,91 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enqueues styles and scripts
|
||||||
|
* Some JS files here are only necessary for Tainacan Item pages
|
||||||
|
*/
|
||||||
|
function blocksy_tainacan_enqueue_scripts() {
|
||||||
|
|
||||||
|
// First, we enqueue parent theme styles
|
||||||
|
if ( !BLOCKSY_TAINACAN_IS_PLUGIN )
|
||||||
|
wp_enqueue_style( 'blocksy-parent-style', get_template_directory_uri() . '/style.css' );
|
||||||
|
|
||||||
|
// Then, this child theme styles
|
||||||
|
wp_enqueue_style( 'tainacan-blocksy-style',
|
||||||
|
BLOCKSY_TAINACAN_PLUGIN_URL_PATH . '/style.min.css',
|
||||||
|
BLOCKSY_TAINACAN_IS_PLUGIN ? array() : array( 'blocksy-parent-style' ),
|
||||||
|
BLOCKSY_TAINACAN_VERSION
|
||||||
|
);
|
||||||
|
|
||||||
|
// Now, some dynamic css that is generated using blocksy dynamic css logic
|
||||||
|
add_action('blocksy:global-dynamic-css:enqueue', function ($args) {
|
||||||
|
blocksy_theme_get_dynamic_styles(array_merge([
|
||||||
|
'path' => BLOCKSY_TAINACAN_PLUGIN_DIR_PATH . '/inc/global.php',
|
||||||
|
'chunk' => 'global',
|
||||||
|
'forced_call' => true
|
||||||
|
], $args));
|
||||||
|
}, 10, 3);
|
||||||
|
|
||||||
|
// This should only happen if we have Tainacan plugin installed
|
||||||
|
if ( defined ('TAINACAN_VERSION') ) {
|
||||||
|
$collections_post_types = \Tainacan\Repositories\Repository::get_collections_db_identifiers();
|
||||||
|
$post_type = get_post_type();
|
||||||
|
|
||||||
|
if ( in_array($post_type, $collections_post_types) ) {
|
||||||
|
wp_enqueue_style( 'swiper', 'https://unpkg.com/swiper/swiper-bundle.min.css', array(), BLOCKSY_TAINACAN_VERSION );
|
||||||
|
wp_enqueue_script( 'swiper', 'https://unpkg.com/swiper/swiper-bundle.min.js', array(), BLOCKSY_TAINACAN_VERSION, true );
|
||||||
|
wp_enqueue_style( 'photoswipe', 'https://cdnjs.cloudflare.com/ajax/libs/photoswipe/4.1.3/photoswipe.min.css', array(), BLOCKSY_TAINACAN_VERSION );
|
||||||
|
wp_enqueue_style( 'photoswipe-skin', 'https://cdnjs.cloudflare.com/ajax/libs/photoswipe/4.1.3/default-skin/default-skin.min.css', array(), BLOCKSY_TAINACAN_VERSION );
|
||||||
|
wp_enqueue_script( 'photoswipe', 'https://cdnjs.cloudflare.com/ajax/libs/photoswipe/4.1.3/photoswipe.min.js', array(), BLOCKSY_TAINACAN_VERSION, true );
|
||||||
|
wp_enqueue_script( 'photoswipe-skin', 'https://cdnjs.cloudflare.com/ajax/libs/photoswipe/4.1.3/photoswipe-ui-default.min.js', array(), BLOCKSY_TAINACAN_VERSION, true );
|
||||||
|
wp_enqueue_script( 'blocksy-tainacan-scripts__swiper', BLOCKSY_TAINACAN_PLUGIN_URL_PATH . '/js/attachments-carousel.js', ['swiper', 'photoswipe', 'photoswipe-skin'], BLOCKSY_TAINACAN_VERSION, true );
|
||||||
|
}
|
||||||
|
|
||||||
|
wp_enqueue_script( 'blocksy-tainacan-scripts', BLOCKSY_TAINACAN_PLUGIN_URL_PATH . '/js/scripts.js', array(), BLOCKSY_TAINACAN_VERSION, true );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
add_action( 'wp_enqueue_scripts', 'blocksy_tainacan_enqueue_scripts' );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enqueues front-end CSS for the items page fixed filters logic.
|
||||||
|
*/
|
||||||
|
if ( !function_exists('blocksy_tainacan_items_page_filters_fixed_on_scroll_output') ) {
|
||||||
|
function blocksy_tainacan_items_page_filters_fixed_on_scroll_output() {
|
||||||
|
$prefix = blocksy_manager()->screen->get_prefix();
|
||||||
|
|
||||||
|
$should_use_fixed_filters_logic = (version_compare(TAINACAN_VERSION, '0.17') >= 0) && get_theme_mod( $prefix . '_filters_fixed_on_scroll', 'no' ) == 'yes';
|
||||||
|
|
||||||
|
if (!$should_use_fixed_filters_logic)
|
||||||
|
return;
|
||||||
|
|
||||||
|
$css = '
|
||||||
|
/* Items list fixed filter logic (Introduced in Tainacan 0.17) */
|
||||||
|
:not(.wp-block-tainacan-faceted-search)>.theme-items-list:not(.is-fullscreen).is-filters-menu-open.is-filters-menu-fixed-at-top .items-list-area {
|
||||||
|
margin-left: var(--tainacan-filter-menu-width-theme) !important;
|
||||||
|
}
|
||||||
|
:not(.wp-block-tainacan-faceted-search)>.theme-items-list:not(.is-fullscreen).is-filters-menu-open.is-filters-menu-fixed-at-top .filters-menu:not(.filters-menu-modal) {
|
||||||
|
position: fixed;
|
||||||
|
top: 0px !important;
|
||||||
|
z-index: 9;
|
||||||
|
}
|
||||||
|
:not(.wp-block-tainacan-faceted-search)>.theme-items-list:not(.is-fullscreen).is-filters-menu-open.is-filters-menu-fixed-at-top .filters-menu:not(.filters-menu-modal) .modal-content {
|
||||||
|
position: absolute;
|
||||||
|
top: 0px;
|
||||||
|
height: auto !important;
|
||||||
|
background: var(--tainacan-background-color, inherit);
|
||||||
|
}
|
||||||
|
:not(.wp-block-tainacan-faceted-search)>.theme-items-list:not(.is-fullscreen).is-filters-menu-open.is-filters-menu-fixed-at-top.is-filters-menu-fixed-at-bottom .filters-menu:not(.filters-menu-modal) {
|
||||||
|
position: absolute;
|
||||||
|
}
|
||||||
|
:not(.wp-block-tainacan-faceted-search)>.theme-items-list:not(.is-fullscreen).is-filters-menu-open.is-filters-menu-fixed-at-top.is-filters-menu-fixed-at-bottom .filters-menu:not(.filters-menu-modal) .modal-content {
|
||||||
|
top: auto;
|
||||||
|
bottom: 0;
|
||||||
|
}
|
||||||
|
';
|
||||||
|
echo '<style type="text/css" id="tainacan-fixed-filters-style">' . sprintf( $css ) . '</style>';
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
add_action( 'wp_head', 'blocksy_tainacan_items_page_filters_fixed_on_scroll_output');
|
||||||
|
|
||||||
|
?>
|
|
@ -31,12 +31,12 @@ if (! function_exists('blc_call_fnc')) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the url to be used in image picker from the child theme.
|
* Return the url to be used in image picker from the child theme.
|
||||||
* The original function is on the /admin/helpers/options.php folder in the parent theme.
|
* The original function is on the /admin/helpers/options.php folder in the Blocksy parent theme.
|
||||||
*
|
*
|
||||||
* @param string $path image name.
|
* @param string $path image name.
|
||||||
*/
|
*/
|
||||||
if (! function_exists('blocksy_tainacan_image_picker_url')) {
|
if (! function_exists('blocksy_tainacan_image_picker_url')) {
|
||||||
function blocksy_tainacan_image_picker_url($path) {
|
function blocksy_tainacan_image_picker_url($path) {
|
||||||
return get_stylesheet_directory_uri() . '/static/images/' . $path;
|
return BLOCKSY_TAINACAN_PLUGIN_URL_PATH . '/static/images/' . $path;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,400 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves an item adjacent link, either using WP strategy or Tainacan plugin tainacan_get_adjacent_items()
|
||||||
|
*/
|
||||||
|
if ( !function_exists('blocksy_tainacan_get_adjacent_item_links') ) {
|
||||||
|
function blocksy_tainacan_get_adjacent_item_links() {
|
||||||
|
|
||||||
|
$prefix = blocksy_manager()->screen->get_prefix();
|
||||||
|
|
||||||
|
// We use Tainacan own method for obtaining previous and next item objects
|
||||||
|
if (function_exists('tainacan_get_adjacent_items') && isset($_GET['pos'])) {
|
||||||
|
$adjacent_items = tainacan_get_adjacent_items();
|
||||||
|
|
||||||
|
if (isset($adjacent_items['next'])) {
|
||||||
|
$next_link_url = $adjacent_items['next']['url'];
|
||||||
|
$next_title = $adjacent_items['next']['title'];
|
||||||
|
} else {
|
||||||
|
$next_link_url = false;
|
||||||
|
}
|
||||||
|
if (isset($adjacent_items['previous'])) {
|
||||||
|
$previous_link_url = $adjacent_items['previous']['url'];
|
||||||
|
$previous_title = $adjacent_items['previous']['title'];
|
||||||
|
} else {
|
||||||
|
$previous_link_url = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
//Get the links to the Previous and Next Post
|
||||||
|
$previous_link_url = get_permalink( get_previous_post() );
|
||||||
|
$next_link_url = get_permalink( get_next_post() );
|
||||||
|
|
||||||
|
//Get the title of the previous post and next post
|
||||||
|
$previous_title = get_the_title( get_previous_post() );
|
||||||
|
$next_title = get_the_title( get_next_post() );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Then we obtain blocksy settings
|
||||||
|
$has_thumb = get_theme_mod($prefix . '_has_post_nav_thumb', 'yes') === 'yes';
|
||||||
|
|
||||||
|
$has_title = get_theme_mod($prefix . '_has_post_nav_title', 'yes') === 'yes';
|
||||||
|
|
||||||
|
$previous = '';
|
||||||
|
$next = '';
|
||||||
|
|
||||||
|
if ($has_thumb) {
|
||||||
|
|
||||||
|
if (function_exists('tainacan_get_adjacent_items') && isset($_GET['pos'])) {
|
||||||
|
if ($adjacent_items['next']) {
|
||||||
|
$next_thumb = $adjacent_items['next']['thumbnail']['tainacan-medium'][0];
|
||||||
|
}
|
||||||
|
if ($adjacent_items['previous']) {
|
||||||
|
$previous_thumb = $adjacent_items['previous']['thumbnail']['tainacan-medium'][0];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
//Get the thumnail url of the previous and next post
|
||||||
|
$previous_thumb = get_the_post_thumbnail_url( get_previous_post(), 'tainacan-medium' );
|
||||||
|
$next_thumb = get_the_post_thumbnail_url( get_next_post(), 'tainacan-medium' );
|
||||||
|
}
|
||||||
|
|
||||||
|
$previous_post_image_output = blocksy_simple_image(
|
||||||
|
$previous_thumb,
|
||||||
|
[
|
||||||
|
'inner_content' => '<svg width="20px" height="15px" viewBox="0 0 20 15"><polygon points="0,7.5 5.5,13 6.4,12.1 2.4,8.1 20,8.1 20,6.9 2.4,6.9 6.4,2.9 5.5,2 "/></svg>',
|
||||||
|
'ratio' => '1/1',
|
||||||
|
'tag_name' => 'figure'
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$next_post_image_output = blocksy_simple_image(
|
||||||
|
$next_thumb,
|
||||||
|
[
|
||||||
|
'inner_content' => '<svg width="20px" height="15px" viewBox="0 0 20 15"><polygon points="14.5,2 13.6,2.9 17.6,6.9 0,6.9 0,8.1 17.6,8.1 13.6,12.1 14.5,13 20,7.5 "/></svg>',
|
||||||
|
'ratio' => '1/1',
|
||||||
|
'tag_name' => 'figure'
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Creates the links
|
||||||
|
$previous = $previous_link_url === false ? '' : (
|
||||||
|
'<a href="' . $previous_link_url .'" rel="prev" class="nav-item-prev"> ' .
|
||||||
|
($has_thumb ? $previous_post_image_output : '') .
|
||||||
|
'<div class="item-content">' .
|
||||||
|
'<span class="item-label">' . __( 'Previous item', 'blocksy-tainacan' ) . '</span>' .
|
||||||
|
(( !empty( $previous_title ) && $has_title ) ? ('<span class="item-title">' . $previous_title . '</span>') : '') .
|
||||||
|
'</div>'.
|
||||||
|
'</a>');
|
||||||
|
|
||||||
|
$next = $next_link_url === false ? '' : (
|
||||||
|
'<a href="' . $next_link_url .'" rel="prev" class="nav-item-next"> ' .
|
||||||
|
'<div class="item-content">' .
|
||||||
|
'<span class="item-label">' . __( 'Next item', 'blocksy-tainacan') . '</span>' .
|
||||||
|
(( !empty( $next_title ) && $has_title) ? ('<span class="item-title">' . $next_title . '</span>') : '') .
|
||||||
|
'</div>' .
|
||||||
|
($has_thumb ? $next_post_image_output : '') .
|
||||||
|
'</a>');
|
||||||
|
|
||||||
|
return ['next' => $next, 'previous' => $previous];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copy of blocksy original post navigation function.
|
||||||
|
* Check inc/template-tags.php post navigation file on the parent theme
|
||||||
|
*/
|
||||||
|
if ( !function_exists('blocksy_default_post_navigation') ) {
|
||||||
|
function blocksy_default_post_navigation() {
|
||||||
|
$next_post = apply_filters(
|
||||||
|
'blocksy:post-navigation:next-post',
|
||||||
|
get_adjacent_post(false, '', true)
|
||||||
|
);
|
||||||
|
|
||||||
|
$previous_post = apply_filters(
|
||||||
|
'blocksy:post-navigation:previous-post',
|
||||||
|
get_adjacent_post(false, '', false)
|
||||||
|
);
|
||||||
|
|
||||||
|
if (! $next_post && ! $previous_post) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
$prefix = blocksy_manager()->screen->get_prefix();
|
||||||
|
|
||||||
|
$container_class = 'post-navigation';
|
||||||
|
|
||||||
|
$container_class .= ' ' . blocksy_visibility_classes(get_theme_mod(
|
||||||
|
$prefix . '_post_nav_visibility',
|
||||||
|
[
|
||||||
|
'desktop' => true,
|
||||||
|
'tablet' => true,
|
||||||
|
'mobile' => true,
|
||||||
|
]
|
||||||
|
));
|
||||||
|
|
||||||
|
$home_page_url = get_home_url();
|
||||||
|
|
||||||
|
$post_slug = get_post_type() === 'post' ? __( 'Post', 'blocksy' ) : get_post_type_object( get_post_type() )->labels->singular_name;
|
||||||
|
$post_slug = '<span>' . $post_slug . '</span>';
|
||||||
|
|
||||||
|
$has_thumb = get_theme_mod($prefix . '_has_post_nav_thumb', 'yes') === 'yes';
|
||||||
|
|
||||||
|
$has_title = get_theme_mod($prefix . '_has_post_nav_title', 'yes') === 'yes';
|
||||||
|
|
||||||
|
$next_post_image_output = '';
|
||||||
|
$previous_post_image_output = '';
|
||||||
|
|
||||||
|
if ($next_post) {
|
||||||
|
$next_title = '';
|
||||||
|
|
||||||
|
if ($has_title) {
|
||||||
|
$next_title = $next_post->post_title;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($has_thumb && get_post_thumbnail_id($next_post)) {
|
||||||
|
$next_post_image_output = blocksy_image(
|
||||||
|
[
|
||||||
|
'attachment_id' => get_post_thumbnail_id( $next_post ),
|
||||||
|
'ratio' => '1/1',
|
||||||
|
'inner_content' => '<svg width="20px" height="15px" viewBox="0 0 20 15"><polygon points="0,7.5 5.5,13 6.4,12.1 2.4,8.1 20,8.1 20,6.9 2.4,6.9 6.4,2.9 5.5,2 "/></svg>',
|
||||||
|
'tag_name' => 'figure'
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($previous_post) {
|
||||||
|
$previous_title = '';
|
||||||
|
if ( $has_title ) {
|
||||||
|
$previous_title = $previous_post->post_title;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($has_thumb && get_post_thumbnail_id($previous_post)) {
|
||||||
|
$previous_post_image_output = blocksy_image(
|
||||||
|
[
|
||||||
|
'attachment_id' => get_post_thumbnail_id( $previous_post ),
|
||||||
|
'ratio' => '1/1',
|
||||||
|
'inner_content' => '<svg width="20px" height="15px" viewBox="0 0 20 15"><polygon points="14.5,2 13.6,2.9 17.6,6.9 0,6.9 0,8.1 17.6,8.1 13.6,12.1 14.5,13 20,7.5 "/></svg>',
|
||||||
|
'tag_name' => 'figure'
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ob_start();
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<nav class="<?php echo esc_attr( $container_class ); ?>">
|
||||||
|
<?php if ($next_post) { ?>
|
||||||
|
<a href="<?php echo esc_url(get_permalink($next_post)); ?>" class="nav-item-prev">
|
||||||
|
<?php if ($has_thumb) { ?>
|
||||||
|
<?php
|
||||||
|
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||||
|
echo $next_post_image_output;
|
||||||
|
?>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
<div class="item-content">
|
||||||
|
<span class="item-label">
|
||||||
|
<?php
|
||||||
|
echo wp_kses_post(sprintf(
|
||||||
|
// translators: post title
|
||||||
|
__( 'Previous %s', 'blocksy' ),
|
||||||
|
$post_slug
|
||||||
|
));
|
||||||
|
?>
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<?php if ( ! empty( $next_title ) ) { ?>
|
||||||
|
<span class="item-title">
|
||||||
|
<?php echo wp_kses_post($next_title); ?>
|
||||||
|
</span>
|
||||||
|
<?php } ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</a>
|
||||||
|
<?php } else { ?>
|
||||||
|
<div class="nav-item-prev"></div>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
<?php if ( $previous_post ) { ?>
|
||||||
|
<a href="<?php echo esc_url( get_permalink( $previous_post ) ); ?>" class="nav-item-next">
|
||||||
|
<div class="item-content">
|
||||||
|
<span class="item-label">
|
||||||
|
<?php
|
||||||
|
echo wp_kses_post(sprintf(
|
||||||
|
// translators: post title
|
||||||
|
__( 'Next %s', 'blocksy' ),
|
||||||
|
$post_slug
|
||||||
|
));
|
||||||
|
?>
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<?php if ( ! empty( $previous_title ) ) { ?>
|
||||||
|
<span class="item-title">
|
||||||
|
<?php echo wp_kses_post($previous_title); ?>
|
||||||
|
</span>
|
||||||
|
<?php } ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php if ($has_thumb) { ?>
|
||||||
|
<?php
|
||||||
|
echo $previous_post_image_output;
|
||||||
|
?>
|
||||||
|
<?php } ?>
|
||||||
|
</a>
|
||||||
|
<?php } else { ?>
|
||||||
|
<div class="nav-item-next"></div>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
return ob_get_clean();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Outputs Tainacan custom logic for items navigation with blocksy features
|
||||||
|
*/
|
||||||
|
if ( !function_exists('blocksy_tainacan_item_navigation') ) {
|
||||||
|
function blocksy_tainacan_item_navigation() {
|
||||||
|
$next = '';
|
||||||
|
$previous = '';
|
||||||
|
$prefix = blocksy_manager()->screen->get_prefix();
|
||||||
|
|
||||||
|
if (get_theme_mod( $prefix . '_has_post_nav', $prefix === 'single_blog_post' ? 'yes' : 'no' ) === 'yes') {
|
||||||
|
|
||||||
|
$container_class = 'post-navigation';
|
||||||
|
|
||||||
|
$container_class .= ' ' . blocksy_visibility_classes(get_theme_mod(
|
||||||
|
$prefix . '_post_nav_visibility',
|
||||||
|
[
|
||||||
|
'desktop' => true,
|
||||||
|
'tablet' => true,
|
||||||
|
'mobile' => true,
|
||||||
|
]
|
||||||
|
));
|
||||||
|
|
||||||
|
$has_thumb = get_theme_mod($prefix . '_has_post_nav_thumb', 'yes') === 'yes';
|
||||||
|
|
||||||
|
if ($has_thumb)
|
||||||
|
$container_class .= ' has-thumbnails';
|
||||||
|
|
||||||
|
$adjacent_links = [
|
||||||
|
'next' => '',
|
||||||
|
'previous' => ''
|
||||||
|
];
|
||||||
|
|
||||||
|
$adjacent_links = blocksy_tainacan_get_adjacent_item_links();
|
||||||
|
|
||||||
|
$previous = $adjacent_links['previous'];
|
||||||
|
$next = $adjacent_links['next'];
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
<?php if ($previous !== '' || $next !== '') : ?>
|
||||||
|
<nav class="<?php echo esc_attr( $container_class ); ?>">
|
||||||
|
<?php if ( $previous !== '' ) {
|
||||||
|
echo $previous;
|
||||||
|
} else { ?>
|
||||||
|
<div class="nav-item-prev"></div>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
<?php if ( $next !== '' ) {
|
||||||
|
echo $next;
|
||||||
|
} else { ?>
|
||||||
|
<div class="nav-item-next"></div>
|
||||||
|
<?php } ?>
|
||||||
|
</nav>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Overrides parent theme blocksy post navigation logic to handle items navigation
|
||||||
|
*/
|
||||||
|
function blocksy_post_navigation() {
|
||||||
|
|
||||||
|
// This should only happen if we have Tainacan plugin installed
|
||||||
|
if ( defined ('TAINACAN_VERSION') ) {
|
||||||
|
$collections_post_types = \Tainacan\Repositories\Repository::get_collections_db_identifiers();
|
||||||
|
$post_type = get_post_type();
|
||||||
|
|
||||||
|
// Check if we're inside the main loop in a single Post.
|
||||||
|
if (in_array($post_type, $collections_post_types) && is_singular() && in_the_loop() && is_main_query() ) {
|
||||||
|
return blocksy_tainacan_item_navigation();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return blocksy_default_post_navigation();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Uses Blocksy filter to customize the related posts logic on Tainacan Items page. (NOT IN USE YET)
|
||||||
|
*/
|
||||||
|
if ( !function_exists('blocksy_tainacan_custom_related_posts_query') ) {
|
||||||
|
function blocksy_tainacan_custom_related_posts_query( $related_posts_query ) {
|
||||||
|
|
||||||
|
// This should only happen if we have Tainacan plugin installed
|
||||||
|
if ( defined ('TAINACAN_VERSION') ) {
|
||||||
|
$collections_post_types = \Tainacan\Repositories\Repository::get_collections_db_identifiers();
|
||||||
|
$post_type = get_post_type();
|
||||||
|
|
||||||
|
// Check if we're inside the main loop in a single Post.
|
||||||
|
if (in_array($post_type, $collections_post_types) && is_singular() && in_the_loop() && is_main_query() ) {
|
||||||
|
// In the future, we might update the related_post_query here for Tainacan items.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $related_posts_query;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//add_filter( 'blocksy:related-posts:query-args', 'blocksy_tainacan_custom_related_posts_query', 10 );
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Uses Blocksy filter to add custom link on the item breadcrumb
|
||||||
|
*/
|
||||||
|
if ( !function_exists('blocksy_tainacan_custom_breadcrumbs') ) {
|
||||||
|
function blocksy_tainacan_custom_breadcrumbs( $array ) {
|
||||||
|
|
||||||
|
// This should only happen if we have Tainacan plugin installed
|
||||||
|
if ( defined ('TAINACAN_VERSION') ) {
|
||||||
|
$collections_post_types = \Tainacan\Repositories\Repository::get_collections_db_identifiers();
|
||||||
|
$post_type = get_post_type();
|
||||||
|
|
||||||
|
// Check if we're inside the main loop in a single Post.
|
||||||
|
if (in_array($post_type, $collections_post_types) && is_singular() && in_the_loop() && is_main_query() ) {
|
||||||
|
$args = $_GET;
|
||||||
|
|
||||||
|
for ($i = 0; $i < count($array); $i++) {
|
||||||
|
|
||||||
|
// Check if the current thumbnail links to the collection, then enriches its URL
|
||||||
|
if (
|
||||||
|
isset($array[$i]['url']) &&
|
||||||
|
isset($args['ref']) &&
|
||||||
|
substr($array[$i]['url'], -strlen($args['ref']))===$args['ref']
|
||||||
|
) {
|
||||||
|
$ref = $args['ref'];
|
||||||
|
unset($args['pos']);
|
||||||
|
unset($args['ref']);
|
||||||
|
unset($args['source_list']);
|
||||||
|
$array[$i]['url'] = $ref . '?' . http_build_query(array_merge($args));
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $array;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $array;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
add_filter( 'blocksy:breadcrumbs:items-array', 'blocksy_tainacan_custom_breadcrumbs', 10, 3 );
|
||||||
|
|
||||||
|
?>
|
|
@ -0,0 +1,16 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$options = [
|
||||||
|
'title' => __('Tainacan Repository Items', 'tainacan-blocksy'),
|
||||||
|
'container' => [ 'priority' => 8 ],
|
||||||
|
'options' => [
|
||||||
|
'tainacan_repository_items_list_section_options' => [
|
||||||
|
'type' => 'ct-options',
|
||||||
|
'setting' => [ 'transport' => 'postMessage' ],
|
||||||
|
'inner-options' => blocksy_get_options(BLOCKSY_TAINACAN_PLUGIN_DIR_PATH . '/inc/options/posts/tainacan-item-archive.php', [
|
||||||
|
'prefix' => 'tainacan-repository-items',
|
||||||
|
'is_general_cpt' => true
|
||||||
|
], false),
|
||||||
|
],
|
||||||
|
],
|
||||||
|
];
|
|
@ -0,0 +1,17 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$options = [
|
||||||
|
'title' => __('Tainacan Terms Items', 'tainacan-blocksy'),
|
||||||
|
'container' => [ 'priority' => 8 ],
|
||||||
|
'options' => [
|
||||||
|
|
||||||
|
'tainacan_terms_items_list_section_options' => [
|
||||||
|
'type' => 'ct-options',
|
||||||
|
'setting' => [ 'transport' => 'postMessage' ],
|
||||||
|
'inner-options' => blocksy_get_options(BLOCKSY_TAINACAN_PLUGIN_DIR_PATH . '/inc/options/posts/tainacan-item-archive.php', [
|
||||||
|
'prefix' => 'tainacan-terms-items',
|
||||||
|
'is_general_cpt' => true
|
||||||
|
], false),
|
||||||
|
],
|
||||||
|
],
|
||||||
|
];
|
|
@ -8,25 +8,25 @@ $options = [
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
|
||||||
blocksy_get_options(get_stylesheet_directory() . '/inc/options/archive-elements/page-header.php', [
|
blocksy_get_options(BLOCKSY_TAINACAN_PLUGIN_DIR_PATH . '/inc/options/archive-elements/page-header.php', [
|
||||||
'prefix' => $post_type->name . '_archive'
|
'prefix' => $prefix . '_archive'
|
||||||
], false),
|
], false),
|
||||||
|
|
||||||
blocksy_get_options(get_stylesheet_directory() . '/inc/options/archive-elements/search-control.php', [
|
blocksy_get_options(BLOCKSY_TAINACAN_PLUGIN_DIR_PATH . '/inc/options/archive-elements/search-control.php', [
|
||||||
'prefix' => $post_type->name . '_archive'
|
'prefix' => $prefix . '_archive'
|
||||||
], false),
|
], false),
|
||||||
|
|
||||||
blocksy_get_options(get_stylesheet_directory() . '/inc/options/archive-elements/filters-panel.php', [
|
blocksy_get_options(BLOCKSY_TAINACAN_PLUGIN_DIR_PATH . '/inc/options/archive-elements/filters-panel.php', [
|
||||||
'prefix' => $post_type->name . '_archive',
|
'prefix' => $prefix . '_archive',
|
||||||
'enabled' => 'yes'
|
'enabled' => 'yes'
|
||||||
], false),
|
], false),
|
||||||
|
|
||||||
blocksy_get_options(get_stylesheet_directory() . '/inc/options/archive-elements/pagination.php', [
|
blocksy_get_options(BLOCKSY_TAINACAN_PLUGIN_DIR_PATH . '/inc/options/archive-elements/pagination.php', [
|
||||||
'prefix' => $post_type->name . '_archive',
|
'prefix' => $prefix . '_archive',
|
||||||
'enabled' => 'yes'
|
'enabled' => 'yes'
|
||||||
], false),
|
], false),
|
||||||
|
|
||||||
blocksy_get_options(get_stylesheet_directory() . '/inc/options/archive-elements/color-palettes.php', [
|
blocksy_get_options(BLOCKSY_TAINACAN_PLUGIN_DIR_PATH . '/inc/options/archive-elements/color-palettes.php', [
|
||||||
'prefix' => $post_type->name . '_archive'
|
'prefix' => $prefix . '_archive'
|
||||||
], false),
|
], false),
|
||||||
];
|
];
|
||||||
|
|
|
@ -15,18 +15,18 @@ $options = [
|
||||||
'label' => __( 'Tainacan Item Elements', 'blocksy-tainacan' ),
|
'label' => __( 'Tainacan Item Elements', 'blocksy-tainacan' ),
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
blocksy_get_options(get_stylesheet_directory() . '/inc/options/single-elements/tainacan-single-structure.php', [
|
blocksy_get_options(BLOCKSY_TAINACAN_PLUGIN_DIR_PATH . '/inc/options/single-elements/tainacan-single-structure.php', [
|
||||||
'prefix' => $post_type->name . '_single',
|
'prefix' => $post_type->name . '_single',
|
||||||
'location' => 'teste'
|
'location' => 'teste'
|
||||||
], false),
|
], false),
|
||||||
blocksy_get_options(get_stylesheet_directory() . '/inc/options/single-elements/section-labels.php', [
|
blocksy_get_options(BLOCKSY_TAINACAN_PLUGIN_DIR_PATH . '/inc/options/single-elements/section-labels.php', [
|
||||||
'prefix' => $post_type->name . '_single',
|
'prefix' => $post_type->name . '_single',
|
||||||
'enabled' => 'yes'
|
'enabled' => 'yes'
|
||||||
], false),
|
], false),
|
||||||
blocksy_get_options(get_stylesheet_directory() . '/inc/options/single-elements/document-attachments.php', [
|
blocksy_get_options(BLOCKSY_TAINACAN_PLUGIN_DIR_PATH . '/inc/options/single-elements/document-attachments.php', [
|
||||||
'prefix' => $post_type->name . '_single',
|
'prefix' => $post_type->name . '_single',
|
||||||
], false),
|
], false),
|
||||||
blocksy_get_options(get_stylesheet_directory() . '/inc/options/single-elements/metadata-list.php', [
|
blocksy_get_options(BLOCKSY_TAINACAN_PLUGIN_DIR_PATH . '/inc/options/single-elements/metadata-list.php', [
|
||||||
'prefix' => $post_type->name . '_single',
|
'prefix' => $post_type->name . '_single',
|
||||||
], false)
|
], false)
|
||||||
];
|
];
|
|
@ -19,18 +19,18 @@ $options = [
|
||||||
'title' => __( 'General', 'blocksy' ),
|
'title' => __( 'General', 'blocksy' ),
|
||||||
'type' => 'tab',
|
'type' => 'tab',
|
||||||
'options' => [
|
'options' => [
|
||||||
blocksy_get_options(get_stylesheet_directory() . '/inc/options/single-elements/document-attachments-structure.php', [
|
blocksy_get_options(BLOCKSY_TAINACAN_PLUGIN_DIR_PATH . '/inc/options/single-elements/document-attachments-structure.php', [
|
||||||
'prefix' => $prefix,
|
'prefix' => $prefix,
|
||||||
'enabled' => 'no'
|
'enabled' => 'no'
|
||||||
], false),
|
], false),
|
||||||
blocksy_get_options(get_stylesheet_directory() . '/inc/options/single-elements/document-attachments-columns.php', [
|
blocksy_get_options(BLOCKSY_TAINACAN_PLUGIN_DIR_PATH . '/inc/options/single-elements/document-attachments-columns.php', [
|
||||||
'prefix' => $prefix
|
'prefix' => $prefix
|
||||||
], false),
|
], false),
|
||||||
blocksy_get_options(get_stylesheet_directory() . '/inc/options/single-elements/hide-download-button.php', [
|
blocksy_get_options(BLOCKSY_TAINACAN_PLUGIN_DIR_PATH . '/inc/options/single-elements/hide-download-button.php', [
|
||||||
'prefix' => $prefix,
|
'prefix' => $prefix,
|
||||||
'enabled' => 'no'
|
'enabled' => 'no'
|
||||||
], false),
|
], false),
|
||||||
blocksy_get_options(get_stylesheet_directory() . '/inc/options/single-elements/hide-files-name.php', [
|
blocksy_get_options(BLOCKSY_TAINACAN_PLUGIN_DIR_PATH . '/inc/options/single-elements/hide-files-name.php', [
|
||||||
'prefix' => $prefix,
|
'prefix' => $prefix,
|
||||||
'enabled' => 'no'
|
'enabled' => 'no'
|
||||||
], false)
|
], false)
|
||||||
|
@ -41,10 +41,10 @@ $options = [
|
||||||
'title' => __( 'Design', 'blocksy' ),
|
'title' => __( 'Design', 'blocksy' ),
|
||||||
'type' => 'tab',
|
'type' => 'tab',
|
||||||
'options' => [
|
'options' => [
|
||||||
blocksy_get_options(get_stylesheet_directory() . '/inc/options/single-elements/attachments-typography.php', [
|
blocksy_get_options(BLOCKSY_TAINACAN_PLUGIN_DIR_PATH . '/inc/options/single-elements/attachments-typography.php', [
|
||||||
'prefix' => $prefix
|
'prefix' => $prefix
|
||||||
], false),
|
], false),
|
||||||
blocksy_get_options(get_stylesheet_directory() . '/inc/options/single-elements/attachments-size.php', [
|
blocksy_get_options(BLOCKSY_TAINACAN_PLUGIN_DIR_PATH . '/inc/options/single-elements/attachments-size.php', [
|
||||||
'prefix' => $prefix
|
'prefix' => $prefix
|
||||||
], false)
|
], false)
|
||||||
],
|
],
|
||||||
|
|
|
@ -19,17 +19,17 @@ $options = [
|
||||||
'title' => __( 'General', 'blocksy' ),
|
'title' => __( 'General', 'blocksy' ),
|
||||||
'type' => 'tab',
|
'type' => 'tab',
|
||||||
'options' => [
|
'options' => [
|
||||||
blocksy_get_options(get_stylesheet_directory() . '/inc/options/single-elements/metadata-list-structure.php', [
|
blocksy_get_options(BLOCKSY_TAINACAN_PLUGIN_DIR_PATH . '/inc/options/single-elements/metadata-list-structure.php', [
|
||||||
'prefix' => $prefix
|
'prefix' => $prefix
|
||||||
], false),
|
], false),
|
||||||
blocksy_get_options(get_stylesheet_directory() . '/inc/options/single-elements/metadata-columns.php', [
|
blocksy_get_options(BLOCKSY_TAINACAN_PLUGIN_DIR_PATH . '/inc/options/single-elements/metadata-columns.php', [
|
||||||
'prefix' => $prefix
|
'prefix' => $prefix
|
||||||
], false),
|
], false),
|
||||||
blocksy_get_options(get_stylesheet_directory() . '/inc/options/single-elements/show-title-metadata.php', [
|
blocksy_get_options(BLOCKSY_TAINACAN_PLUGIN_DIR_PATH . '/inc/options/single-elements/show-title-metadata.php', [
|
||||||
'prefix' => $prefix,
|
'prefix' => $prefix,
|
||||||
'enabled' => 'yes'
|
'enabled' => 'yes'
|
||||||
], false),
|
], false),
|
||||||
blocksy_get_options(get_stylesheet_directory() . '/inc/options/single-elements/show-thumbnail.php', [
|
blocksy_get_options(BLOCKSY_TAINACAN_PLUGIN_DIR_PATH . '/inc/options/single-elements/show-thumbnail.php', [
|
||||||
'prefix' => $prefix,
|
'prefix' => $prefix,
|
||||||
'enabled' => 'no'
|
'enabled' => 'no'
|
||||||
], false),
|
], false),
|
||||||
|
@ -40,10 +40,10 @@ $options = [
|
||||||
'title' => __( 'Design', 'blocksy' ),
|
'title' => __( 'Design', 'blocksy' ),
|
||||||
'type' => 'tab',
|
'type' => 'tab',
|
||||||
'options' => [
|
'options' => [
|
||||||
blocksy_get_options(get_stylesheet_directory() . '/inc/options/single-elements/metadata-labels.php', [
|
blocksy_get_options(BLOCKSY_TAINACAN_PLUGIN_DIR_PATH . '/inc/options/single-elements/metadata-labels.php', [
|
||||||
'prefix' => $prefix
|
'prefix' => $prefix
|
||||||
], false),
|
], false),
|
||||||
blocksy_get_options(get_stylesheet_directory() . '/inc/options/single-elements/metadata-values.php', [
|
blocksy_get_options(BLOCKSY_TAINACAN_PLUGIN_DIR_PATH . '/inc/options/single-elements/metadata-values.php', [
|
||||||
'prefix' => $prefix
|
'prefix' => $prefix
|
||||||
], false)
|
], false)
|
||||||
],
|
],
|
||||||
|
|
|
@ -0,0 +1,54 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Uses Template redirect for setting the proper template to items
|
||||||
|
* archives on Tainacan pages
|
||||||
|
*/
|
||||||
|
if ( !function_exists('blocksy_tainacan_archive_templates_redirects') )
|
||||||
|
function blocksy_tainacan_archive_templates_redirects() {
|
||||||
|
global $wp_query;
|
||||||
|
if (is_post_type_archive()) {
|
||||||
|
|
||||||
|
$collections_post_types = \Tainacan\Repositories\Repository::get_collections_db_identifiers();
|
||||||
|
$current_post_type = get_post_type();
|
||||||
|
|
||||||
|
if (in_array($current_post_type, $collections_post_types)) {
|
||||||
|
|
||||||
|
if (is_post_type_archive()) {
|
||||||
|
include( BLOCKSY_TAINACAN_PLUGIN_DIR_PATH . '/tainacan/archive-items.php' );
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if ( is_tax() ) {
|
||||||
|
$term = get_queried_object();
|
||||||
|
|
||||||
|
if ( isset($term->taxonomy) && \Tainacan\Theme_Helper::get_instance()->is_taxonomy_a_tainacan_tax($term->taxonomy)) {
|
||||||
|
$tax_id = \Tainacan\Repositories\Taxonomies::get_instance()->get_id_by_db_identifier($term->taxonomy);
|
||||||
|
$tax = \Tainacan\Repositories\Taxonomies::get_instance()->fetch($tax_id);
|
||||||
|
|
||||||
|
include( BLOCKSY_TAINACAN_PLUGIN_DIR_PATH . '/tainacan/archive-taxonomy.php' );
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
} else if ( $wp_query->get( 'tainacan_repository_archive' ) == 1 ) {
|
||||||
|
|
||||||
|
include( BLOCKSY_TAINACAN_PLUGIN_DIR_PATH . '/tainacan/archive-items.php' );
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
add_action('template_redirect', 'blocksy_tainacan_archive_templates_redirects');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Uses Template redirect for setting the proper template to items
|
||||||
|
* archives on Tainacan pages
|
||||||
|
*/
|
||||||
|
if ( !function_exists('blocksy_tainacan_update_extensions_paths') )
|
||||||
|
function blocksy_tainacan_update_extensions_paths($paths) {
|
||||||
|
var_dump($paths);
|
||||||
|
return $paths;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
add_filter( 'blocksy_extensions_paths', 'blocksy_tainacan_update_extensions_paths');
|
||||||
|
|
||||||
|
?>
|
|
@ -283,6 +283,7 @@ body:not(.tainacan-admin-page) {
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
|
|
||||||
.page-title {
|
.page-title {
|
||||||
|
margin-top: 0px;
|
||||||
margin-bottom: 4px;
|
margin-bottom: 4px;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
}
|
}
|
||||||
|
|
|
@ -215,7 +215,7 @@
|
||||||
.tainacan-item-section__attachments-file {
|
.tainacan-item-section__attachments-file {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
vertical-align: top;
|
vertical-align: top;
|
||||||
cursor: pointer;
|
cursor: zoom-in;
|
||||||
word-break: break-all;
|
word-break: break-all;
|
||||||
font-size: 0.875em;
|
font-size: 0.875em;
|
||||||
max-width: calc(var(--attachments-size, 157px) + 17px);
|
max-width: calc(var(--attachments-size, 157px) + 17px);
|
||||||
|
@ -252,13 +252,13 @@
|
||||||
max-width: var(--attachments-size, 140px);
|
max-width: var(--attachments-size, 140px);
|
||||||
text-align: center;
|
text-align: center;
|
||||||
word-break: break-all;
|
word-break: break-all;
|
||||||
|
cursor: zoom-in;
|
||||||
}
|
}
|
||||||
a,
|
a,
|
||||||
a:focus,
|
a:focus,
|
||||||
a:hover {
|
a:hover {
|
||||||
outline: none;
|
outline: none;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
cursor: pointer;
|
|
||||||
color: black;
|
color: black;
|
||||||
}
|
}
|
||||||
.attachment-without-image img {
|
.attachment-without-image img {
|
||||||
|
|
|
@ -308,6 +308,7 @@ body:not(.tainacan-admin-page) .tainacan-modal-content .modal-card-body {
|
||||||
}
|
}
|
||||||
|
|
||||||
.tainacan-collection-header .tainacan-collection-header__box .page-title {
|
.tainacan-collection-header .tainacan-collection-header__box .page-title {
|
||||||
|
margin-top: 0px;
|
||||||
margin-bottom: 4px;
|
margin-bottom: 4px;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
}
|
}
|
||||||
|
@ -594,7 +595,7 @@ body:not(.tainacan-admin-page) .tainacan-modal-content .modal-card-body {
|
||||||
.tainacan-item-single .tainacan-item-section__attachments .tainacan-item-section__attachments-file {
|
.tainacan-item-single .tainacan-item-section__attachments .tainacan-item-section__attachments-file {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
vertical-align: top;
|
vertical-align: top;
|
||||||
cursor: pointer;
|
cursor: zoom-in;
|
||||||
word-break: break-all;
|
word-break: break-all;
|
||||||
font-size: 0.875em;
|
font-size: 0.875em;
|
||||||
max-width: calc(var(--attachments-size, 157px) + 17px);
|
max-width: calc(var(--attachments-size, 157px) + 17px);
|
||||||
|
@ -642,6 +643,7 @@ body:not(.tainacan-admin-page) .tainacan-modal-content .modal-card-body {
|
||||||
max-width: var(--attachments-size, 140px);
|
max-width: var(--attachments-size, 140px);
|
||||||
text-align: center;
|
text-align: center;
|
||||||
word-break: break-all;
|
word-break: break-all;
|
||||||
|
cursor: zoom-in;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tainacan-item-single .tainacan-item-section__gallery-items .tainacan-item-section__attachments-file a,
|
.tainacan-item-single .tainacan-item-section__gallery-items .tainacan-item-section__attachments-file a,
|
||||||
|
@ -652,7 +654,6 @@ body:not(.tainacan-admin-page) .tainacan-modal-content .modal-card-body {
|
||||||
.tainacan-item-single .tainacan-item-section__attachments .tainacan-item-section__attachments-file a:hover {
|
.tainacan-item-single .tainacan-item-section__attachments .tainacan-item-section__attachments-file a:hover {
|
||||||
outline: none;
|
outline: none;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
cursor: pointer;
|
|
||||||
color: black;
|
color: black;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
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
|
@ -1,13 +1,12 @@
|
||||||
<?php
|
<?php
|
||||||
$prefix = blocksy_manager()->screen->get_prefix();
|
|
||||||
|
|
||||||
$page_container_classes = 'page type-page hentry singular';
|
$page_container_classes = 'page type-page hentry singular';
|
||||||
$page_container_classes = $page_container_classes . ( get_theme_mod($prefix . '_filters_panel_background_style', 'boxed') == 'boxed' ? ' has-filters-panel-style-boxed' : '' );
|
$page_container_classes = $page_container_classes . ( get_theme_mod('tainacan-repository-items_archive_filters_panel_background_style', 'boxed') == 'boxed' ? ' has-filters-panel-style-boxed' : '' );
|
||||||
|
|
||||||
$filters_panel_size = get_theme_mod($prefix . '_filters_panel_size', '20%');
|
$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 . ';';
|
$page_container_style = '--tainacan-filter-menu-width-theme:' . $filters_panel_size . ';';
|
||||||
|
|
||||||
$background_color_palette = get_theme_mod($prefix . '_items_list_background_palette',
|
$background_color_palette = get_theme_mod('tainacan-repository-items_archive_items_list_background_palette',
|
||||||
[
|
[
|
||||||
'color1' => [ 'color' => 'var(--background-color, #f8f9fb)' ],
|
'color1' => [ 'color' => 'var(--background-color, #f8f9fb)' ],
|
||||||
'color2' => [ 'color' => 'var(--cardBackground, #ffffff)' ],
|
'color2' => [ 'color' => 'var(--cardBackground, #ffffff)' ],
|
||||||
|
@ -21,7 +20,7 @@ $page_container_style .= '--tainacan-item-background-hover-color:' . $background
|
||||||
$page_container_style .= '--tainacan-input-background-color:' . $background_color_palette['color4']['color'] . ';';
|
$page_container_style .= '--tainacan-input-background-color:' . $background_color_palette['color4']['color'] . ';';
|
||||||
$page_container_style .= '--tainacan-primary-color:' . $background_color_palette['color5']['color'] . ';';
|
$page_container_style .= '--tainacan-primary-color:' . $background_color_palette['color5']['color'] . ';';
|
||||||
|
|
||||||
$text_color_palette = get_theme_mod($prefix . '_items_list_text_palette',
|
$text_color_palette = get_theme_mod('tainacan-repository-items_archive_items_list_text_palette',
|
||||||
[
|
[
|
||||||
'color1' => [ 'color' => 'var(--paletteColor1,#3eaf7c)' ],
|
'color1' => [ 'color' => 'var(--paletteColor1,#3eaf7c)' ],
|
||||||
'color2' => [ 'color' => 'var(--headingColor, rgba(44, 62, 80, 1))' ],
|
'color2' => [ 'color' => 'var(--headingColor, rgba(44, 62, 80, 1))' ],
|
||||||
|
@ -53,7 +52,20 @@ $page_container_style .= 'background-color: var(--tainacan-background-color, #f8
|
||||||
<div class="entry-content">
|
<div class="entry-content">
|
||||||
<?php
|
<?php
|
||||||
tainacan_the_faceted_search([
|
tainacan_the_faceted_search([
|
||||||
'show-filters-button-inside-search-control' => true
|
'hide_filters' => get_theme_mod('tainacan-repository-items_archive_display_filters_panel', 'yes') == 'no',
|
||||||
|
'start_with_filters_hidden' => get_theme_mod('tainacan-repository-items_archive_start_with_filters_hidden', 'no') == 'yes',
|
||||||
|
'hide_hide_filters_button' => get_theme_mod('tainacan-repository-items_archive_show_hide_filters_button', 'yes') == 'no',
|
||||||
|
'show_filters_button_inside_search_control' => get_theme_mod('tainacan-repository-items_archive_show_filters_button_inside_search_control', 'yes') == 'yes',
|
||||||
|
'filters_as_modal' => get_theme_mod('tainacan-repository-items_archive_filters_as_modal', 'no') == 'yes',
|
||||||
|
'hide_search' => get_theme_mod('tainacan-repository-items_archive_show_search', 'yes') == 'no',
|
||||||
|
'hide_advanced_search' => get_theme_mod('tainacan-repository-items_archive_show_advanced_search', 'yes') == 'no',
|
||||||
|
'hide_sorting_area' => get_theme_mod('tainacan-repository-items_archive_show_sorting_area', 'yes') == 'no',
|
||||||
|
'hide_sort_by_button' => get_theme_mod('tainacan-repository-items_archive_show_sort_by_button', 'yes') == 'no',
|
||||||
|
'hide_displayed_metadata_dropdown' => get_theme_mod('tainacan-repository-items_archive_show_displayed_metadata_dropdown', 'yes') == 'no',
|
||||||
|
'show_inline_view_mode_options' => get_theme_mod('tainacan-repository-items_archive_show_inline_view_mode_options', 'no') == 'yes',
|
||||||
|
'show_fullscreen_with_view_modes' => get_theme_mod('tainacan-repository-items_archive_show_fullscreen_with_view_modes', 'no') == 'yes',
|
||||||
|
'hide_exposers_button' => get_theme_mod('tainacan-repository-items_archive_show_exposers_button', 'yes') == 'no',
|
||||||
|
'hide_pagination_area' => get_theme_mod('tainacan-repository-items_archive_has_pagination', 'yes') == 'no',
|
||||||
]);
|
]);
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$page_container_classes = 'page type-page hentry singular';
|
$page_container_classes = 'page type-page hentry singular';
|
||||||
$page_container_classes = $page_container_classes . ( get_theme_mod('tainacan-terms-items_filters_panel_background_style', 'boxed') == 'boxed' ? ' has-filters-panel-style-boxed' : '' );
|
$page_container_classes = $page_container_classes . ( get_theme_mod('tainacan-terms-items_archive_filters_panel_background_style', 'boxed') == 'boxed' ? ' has-filters-panel-style-boxed' : '' );
|
||||||
|
$page_container_classes = $page_container_classes . ( get_theme_mod('tainacan-terms-items_archive_page_header_background_style', 'boxed') == 'boxed' ? ' has-page-header-style-boxed' : '' );
|
||||||
|
|
||||||
$filters_panel_size = get_theme_mod('tainacan-terms-items_filters_panel_size', '20%');
|
$filters_panel_size = get_theme_mod('tainacan-terms-items_archive_filters_panel_size', '20%');
|
||||||
$page_container_style = '--tainacan-filter-menu-width-theme:' . $filters_panel_size . ';';
|
$page_container_style = '--tainacan-filter-menu-width-theme:' . $filters_panel_size . ';';
|
||||||
|
|
||||||
$background_color_palette = get_theme_mod('tainacan-terms-items_items_list_background_palette',
|
$background_color_palette = get_theme_mod('tainacan-terms-items_archive_items_list_background_palette',
|
||||||
[
|
[
|
||||||
'color1' => [ 'color' => 'var(--background-color, #f8f9fb)' ],
|
'color1' => [ 'color' => 'var(--background-color, #f8f9fb)' ],
|
||||||
'color2' => [ 'color' => 'var(--cardBackground, #ffffff)' ],
|
'color2' => [ 'color' => 'var(--cardBackground, #ffffff)' ],
|
||||||
|
@ -20,7 +21,7 @@ $page_container_style .= '--tainacan-item-background-hover-color:' . $background
|
||||||
$page_container_style .= '--tainacan-input-background-color:' . $background_color_palette['color4']['color'] . ';';
|
$page_container_style .= '--tainacan-input-background-color:' . $background_color_palette['color4']['color'] . ';';
|
||||||
$page_container_style .= '--tainacan-primary-color:' . $background_color_palette['color5']['color'] . ';';
|
$page_container_style .= '--tainacan-primary-color:' . $background_color_palette['color5']['color'] . ';';
|
||||||
|
|
||||||
$text_color_palette = get_theme_mod('tainacan-terms-items_items_list_text_palette',
|
$text_color_palette = get_theme_mod('tainacan-terms-items_archive_items_list_text_palette',
|
||||||
[
|
[
|
||||||
'color1' => [ 'color' => 'var(--paletteColor1,#3eaf7c)' ],
|
'color1' => [ 'color' => 'var(--paletteColor1,#3eaf7c)' ],
|
||||||
'color2' => [ 'color' => 'var(--headingColor, rgba(44, 62, 80, 1))' ],
|
'color2' => [ 'color' => 'var(--headingColor, rgba(44, 62, 80, 1))' ],
|
||||||
|
@ -36,11 +37,13 @@ $page_container_style .= '--tainacan-input-color:' . $text_color_palette['color5
|
||||||
|
|
||||||
$page_container_style .= 'background-color: var(--tainacan-background-color, #f8f9fb);';
|
$page_container_style .= 'background-color: var(--tainacan-background-color, #f8f9fb);';
|
||||||
|
|
||||||
|
// Fetches current term to obtain proper image
|
||||||
$current_term = tainacan_get_term();
|
$current_term = tainacan_get_term();
|
||||||
$current_taxonomy = get_taxonomy( $current_term->taxonomy );
|
$current_taxonomy = get_taxonomy( $current_term->taxonomy );
|
||||||
$current_term = \Tainacan\Repositories\Terms::get_instance()->fetch($current_term->term_id, $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();
|
$image = $current_term->get_header_image_id();
|
||||||
$src = wp_get_attachment_image_src($image, 'full');
|
$src = wp_get_attachment_image_src($image, 'full');
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<?php get_header(); ?>
|
<?php get_header(); ?>
|
||||||
|
@ -48,13 +51,37 @@ $src = wp_get_attachment_image_src($image, 'full');
|
||||||
|
|
||||||
<header class="tainacan-collection-header">
|
<header class="tainacan-collection-header">
|
||||||
<div class="tainacan-collection-header__box">
|
<div class="tainacan-collection-header__box">
|
||||||
<?php if ($src && $src[0]) : ?>
|
|
||||||
<div class="collection-thumbnail">
|
|
||||||
<img src="<?php echo($src[0]) ?>">
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php
|
<?php
|
||||||
echo blocksy_output_hero_section( 'type-1' );
|
|
||||||
|
$thumbnail_element = '';
|
||||||
|
$is_thumbnail_enabled = false;
|
||||||
|
$hero_elements = blocksy_akg_or_customizer(
|
||||||
|
'hero_elements',
|
||||||
|
[ 'prefix' => 'tainacan-terms-items_archive' ],
|
||||||
|
[]
|
||||||
|
);
|
||||||
|
|
||||||
|
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 = '
|
||||||
|
<div class="collection-thumbnail">
|
||||||
|
<img src="' . $src[0] . '">
|
||||||
|
</div>
|
||||||
|
';
|
||||||
|
}
|
||||||
|
|
||||||
|
$elements = $thumbnail_element . blocksy_render_view(
|
||||||
|
get_template_directory() . '/inc/components/hero/elements.php', [ 'type' => 'type-1' ]
|
||||||
|
);
|
||||||
|
echo blocksy_output_hero_section([
|
||||||
|
'type' => 'type-1',
|
||||||
|
'source' => false,
|
||||||
|
'elements' => $elements
|
||||||
|
]);
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
@ -62,7 +89,20 @@ $src = wp_get_attachment_image_src($image, 'full');
|
||||||
<div class="entry-content">
|
<div class="entry-content">
|
||||||
<?php
|
<?php
|
||||||
tainacan_the_faceted_search([
|
tainacan_the_faceted_search([
|
||||||
'show-filters-button-inside-search-control' => true
|
'hide_filters' => get_theme_mod('tainacan-terms-items_archive_display_filters_panel', 'yes') == 'no',
|
||||||
|
'start_with_filters_hidden' => get_theme_mod('tainacan-terms-items_archive_start_with_filters_hidden', 'no') == 'yes',
|
||||||
|
'hide_hide_filters_button' => get_theme_mod('tainacan-terms-items_archive_show_hide_filters_button', 'yes') == 'no',
|
||||||
|
'show_filters_button_inside_search_control' => get_theme_mod('tainacan-terms-items_archive_show_filters_button_inside_search_control', 'yes') == 'yes',
|
||||||
|
'filters_as_modal' => get_theme_mod('tainacan-terms-items_archive_filters_as_modal', 'no') == 'yes',
|
||||||
|
'hide_search' => get_theme_mod('tainacan-terms-items_archive_show_search', 'yes') == 'no',
|
||||||
|
'hide_advanced_search' => get_theme_mod('tainacan-terms-items_archive_show_advanced_search', 'yes') == 'no',
|
||||||
|
'hide_sorting_area' => get_theme_mod('tainacan-terms-items_archive_show_sorting_area', 'yes') == 'no',
|
||||||
|
'hide_sort_by_button' => get_theme_mod('tainacan-terms-items_archive_show_sort_by_button', 'yes') == 'no',
|
||||||
|
'hide_displayed_metadata_dropdown' => get_theme_mod('tainacan-terms-items_archive_show_displayed_metadata_dropdown', 'yes') == 'no',
|
||||||
|
'show_inline_view_mode_options' => get_theme_mod('tainacan-terms-items_archive_show_inline_view_mode_options', 'no') == 'yes',
|
||||||
|
'show_fullscreen_with_view_modes' => get_theme_mod('tainacan-terms-items_archive_show_fullscreen_with_view_modes', 'no') == 'yes',
|
||||||
|
'hide_exposers_button' => get_theme_mod('tainacan-terms-items_archive_show_exposers_button', 'yes') == 'no',
|
||||||
|
'hide_pagination_area' => get_theme_mod('tainacan-terms-items_archive_has_pagination', 'yes') == 'no',
|
||||||
]);
|
]);
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
<?php do_action( 'blocksy-tainacan-single-item-metadata-begin' ); ?>
|
<?php do_action( 'blocksy-tainacan-single-item-metadata-begin' ); ?>
|
||||||
<?php
|
<?php
|
||||||
$args = array(
|
$args = array(
|
||||||
|
'display_slug_as_class' => true,
|
||||||
'before_title' => '<h3 class="tainacan-metadata-label">',
|
'before_title' => '<h3 class="tainacan-metadata-label">',
|
||||||
'after_title' => '</h3>',
|
'after_title' => '</h3>',
|
||||||
'before_value' => '<p class="tainacan-metadata-value">',
|
'before_value' => '<p class="tainacan-metadata-value">',
|
||||||
|
|
Loading…
Reference in New Issue