FEATURE Handling the collective access button redirection
This commit is contained in:
parent
f6111ab21b
commit
14fe284679
|
|
@ -8,6 +8,7 @@ $current_post_type = get_post_type();
|
|||
<main id="content" class="site-content flex-grow">
|
||||
<?php get_template_part('template-parts/post-types/fonds-archives/archive-header'); ?>
|
||||
|
||||
<?php get_template_part('template-parts/components/collective-acess-button'); ?>
|
||||
|
||||
|
||||
<!-- #### ARCHIVE POST GRID #### -->
|
||||
|
|
|
|||
|
|
@ -442,3 +442,25 @@ function get_current_post_numerotation($post_id)
|
|||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
function is_a_collections_page()
|
||||
{
|
||||
$collection_parent_page_id = 83;
|
||||
$current_page_id = (int) get_queried_object_id();
|
||||
|
||||
|
||||
if ($collection_parent_page_id === $current_page_id || $is_fond_archive_fonds_archives) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($current_page_id) {
|
||||
$ancestors = get_post_ancestors($current_page_id, 'page');
|
||||
|
||||
if (in_array($collection_parent_page_id, array_map('intval', $ancestors), true)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
3
page.php
3
page.php
|
|
@ -6,6 +6,9 @@
|
|||
while (have_posts()) :
|
||||
the_post();
|
||||
the_content();
|
||||
if (is_a_collections_page()) {
|
||||
get_template_part('template-parts/components/collective-acess-button');
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
|
|
|
|||
15
template-parts/components/collective-acess-button.php
Normal file
15
template-parts/components/collective-acess-button.php
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
/**
|
||||
* Collective Access Button
|
||||
*
|
||||
* @package Carhop
|
||||
* @subpackage Components
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
?>
|
||||
<a href="https://collectiveaccess.org" class="collective-access-button" target="_blank">
|
||||
<span class="collective-access-button-text">
|
||||
Collective Access
|
||||
</span>
|
||||
</a>
|
||||
Loading…
Reference in New Issue
Block a user