2021-02-23 02:09:46 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Uses Template redirect for setting the proper template to items
|
|
|
|
* archives on Tainacan pages
|
|
|
|
*/
|
2021-04-14 17:40:23 +00:00
|
|
|
if ( !function_exists('tainacan_blocksy_archive_templates_redirects') ) {
|
|
|
|
function tainacan_blocksy_archive_templates_redirects() {
|
2021-02-23 02:09:46 +00:00
|
|
|
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()) {
|
2021-04-14 17:40:23 +00:00
|
|
|
include( TAINACAN_BLOCKSY_PLUGIN_DIR_PATH . '/tainacan/archive-items.php' );
|
2021-02-23 02:09:46 +00:00
|
|
|
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);
|
|
|
|
|
2021-04-14 17:40:23 +00:00
|
|
|
include( TAINACAN_BLOCKSY_PLUGIN_DIR_PATH . '/tainacan/archive-taxonomy.php' );
|
2021-02-23 02:09:46 +00:00
|
|
|
exit;
|
|
|
|
}
|
|
|
|
} else if ( $wp_query->get( 'tainacan_repository_archive' ) == 1 ) {
|
|
|
|
|
2021-04-14 17:40:23 +00:00
|
|
|
include( TAINACAN_BLOCKSY_PLUGIN_DIR_PATH . '/tainacan/archive-items.php' );
|
2021-02-23 02:09:46 +00:00
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
2021-04-14 17:40:23 +00:00
|
|
|
add_action('template_redirect', 'tainacan_blocksy_archive_templates_redirects');
|
2021-02-23 02:09:46 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Uses Template redirect for setting the proper template to items
|
|
|
|
* archives on Tainacan pages
|
|
|
|
*/
|
2021-04-14 17:40:23 +00:00
|
|
|
if ( !function_exists('tainacan_blocksy_update_extensions_paths') ) {
|
|
|
|
function tainacan_blocksy_update_extensions_paths($paths) {
|
2021-02-23 02:09:46 +00:00
|
|
|
return $paths;
|
|
|
|
}
|
|
|
|
}
|
2021-04-14 17:40:23 +00:00
|
|
|
add_filter( 'blocksy_extensions_paths', 'tainacan_blocksy_update_extensions_paths');
|
2021-02-23 02:09:46 +00:00
|
|
|
|
|
|
|
?>
|