working on bradcrumbs and internal links
This commit is contained in:
parent
f22ffdde58
commit
4f6aee68e0
|
|
@ -15,4 +15,3 @@ require_once(__DIR__ . '/includes/templates.php');
|
||||||
require_once(__DIR__ . '/includes/ajax.php');
|
require_once(__DIR__ . '/includes/ajax.php');
|
||||||
|
|
||||||
// require_once(__DIR__ . '/includes/widget.php');
|
// require_once(__DIR__ . '/includes/widget.php');
|
||||||
// require_once( __DIR__ . '/includes/logos.php');
|
|
||||||
|
|
@ -1,19 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* ------------------------------
|
|
||||||
ENABLE SVG
|
|
||||||
------------------------------*/
|
|
||||||
|
|
||||||
|
|
||||||
function cc_mime_types($mimes)
|
|
||||||
{
|
|
||||||
$mimes['svg'] = 'image/svg+xml';
|
|
||||||
return $mimes;
|
|
||||||
}
|
|
||||||
add_filter('upload_mimes', 'cc_mime_types');
|
|
||||||
|
|
||||||
/* ---------------------------
|
/* ---------------------------
|
||||||
PAGE D'OPTIONS DU THEME
|
PAGE D'OPTIONS DU THEME
|
||||||
---------------------------*/
|
---------------------------*/
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,20 @@ function getParentThematique($thematique)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DOES THE SAME THING AS ABOVE BUT RENAMED
|
||||||
|
function getMainThematique($thematique)
|
||||||
|
{
|
||||||
|
if (!$thematique) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($thematique->parent == 0) {
|
||||||
|
return $thematique;
|
||||||
|
} else {
|
||||||
|
return get_term($thematique->parent, 'thematiques');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Get automatic post used in BLOCK QUESTIONS FREQUENTES
|
// Get automatic post used in BLOCK QUESTIONS FREQUENTES
|
||||||
function get_automatic_post($post_type)
|
function get_automatic_post($post_type)
|
||||||
|
|
@ -62,3 +76,14 @@ function get_automatic_post($post_type)
|
||||||
);
|
);
|
||||||
return get_posts($automatic_query_args)[0];
|
return get_posts($automatic_query_args)[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// TO GET ARCHIVE RELATED PAGES BY TEMPLATE
|
||||||
|
function get_page_by_template($template = '')
|
||||||
|
{
|
||||||
|
$args = array(
|
||||||
|
'meta_key' => '_wp_page_template',
|
||||||
|
'meta_value' => $template
|
||||||
|
);
|
||||||
|
return get_pages($args);
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,12 +34,44 @@ function build_chapter_index($blocks)
|
||||||
<?php if (have_posts()) : ?>
|
<?php if (have_posts()) : ?>
|
||||||
<?php while (have_posts()) : the_post(); ?>
|
<?php while (have_posts()) : the_post(); ?>
|
||||||
<?php
|
<?php
|
||||||
$thematique = get_the_terms(get_the_ID(), 'thematiques')[0];
|
$currentThematique = get_the_terms(get_the_ID(), 'thematiques')[0];
|
||||||
$thematiqueParent = getParentThematique($thematique);
|
$mainThematique = getMainThematique($currentThematique);
|
||||||
// $thematiqueColorSlug = getThematiqueFamilySlug($thematiqueParent->slug);
|
$thematiqueColorSlug = $mainThematique->slug;
|
||||||
$thematiqueColorSlug = $thematiqueParent->slug;
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<div class="post-conseil-page-container <?php echo $thematiqueColorSlug ? "post-conseil-page--" . $thematiqueColorSlug : "" ?>"">
|
<div class="post-conseil-page-container <?php echo $thematiqueColorSlug ? "post-conseil-page--" . $thematiqueColorSlug : "" ?>"">
|
||||||
|
<nav class=" breadcrumbs_navigation" aria-label="breadcrumbs">
|
||||||
|
<?php
|
||||||
|
$archiveConseils = get_page_by_template('template-archive-conseils.php')[0];
|
||||||
|
|
||||||
|
|
||||||
|
?>
|
||||||
|
<ol>
|
||||||
|
<li><a href="<?php echo home_url() ?>">Home</a></li>
|
||||||
|
<li><a href="<?php echo get_post_permalink($archiveConseils) ?>"><?php echo $archiveConseils->post_title ?></a></li>
|
||||||
|
<?php if ($mainThematique != $currentThematique) : ?>
|
||||||
|
<?php
|
||||||
|
$args = array(
|
||||||
|
'post_type' => 'conseils', // the post type
|
||||||
|
'tax_query' => array(
|
||||||
|
array(
|
||||||
|
'taxonomy' => 'thematiques', // the custom vocabulary
|
||||||
|
'field' => 'term_id', // term_id, slug or name
|
||||||
|
'terms' => array($mainThematique->term_id),
|
||||||
|
'include_children' => false,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
$mainThematiqueRelatedConseil = get_posts($args)[0] ?? null;
|
||||||
|
?>
|
||||||
|
<li><a href="<?php echo get_post_permalink($mainThematiqueRelatedConseil) ?>"><?php echo $mainThematique->name ?></a></li>
|
||||||
|
|
||||||
|
<?php endif; ?>
|
||||||
|
<li><a href="<?php echo the_permalink() ?>" aria-current="location"><?php echo $currentThematique->name ?></a></li>
|
||||||
|
|
||||||
|
</ol>
|
||||||
|
</nav>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
$blocks = parse_blocks($post->post_content);
|
$blocks = parse_blocks($post->post_content);
|
||||||
$chapterBlockIndex = build_chapter_index($blocks);
|
$chapterBlockIndex = build_chapter_index($blocks);
|
||||||
|
|
|
||||||
|
|
@ -7,10 +7,6 @@ $thematiqueColorSlug = getThematiqueFamilySlug($thematique_generale->slug);
|
||||||
|
|
||||||
$current_children_thematique = get_queried_object()->parent != 0 ? get_queried_object() : null;
|
$current_children_thematique = get_queried_object()->parent != 0 ? get_queried_object() : null;
|
||||||
|
|
||||||
echo '<pre>';
|
|
||||||
print_r($thematiqueColorSlug);
|
|
||||||
echo '</pre>';
|
|
||||||
|
|
||||||
|
|
||||||
$args = array(
|
$args = array(
|
||||||
'posts_per_page' => 1,
|
'posts_per_page' => 1,
|
||||||
|
|
@ -28,35 +24,19 @@ $args = array(
|
||||||
$query_current_thematique_posts = new WP_Query($args);
|
$query_current_thematique_posts = new WP_Query($args);
|
||||||
$thematique_related_page = $query_current_thematique_posts->posts[0];
|
$thematique_related_page = $query_current_thematique_posts->posts[0];
|
||||||
|
|
||||||
echo '<pre>';
|
|
||||||
// print_r($term);
|
|
||||||
// print_r($term_test);
|
|
||||||
// print_r($query_current_thematique_posts->posts);
|
|
||||||
// print_r($thematique_related_page);
|
|
||||||
// print_r($current_children_thematique);
|
|
||||||
// print_r($current_thematique);
|
|
||||||
// print_r(is_tax('thematiques', 'thematiques'));
|
|
||||||
echo '</pre>';
|
|
||||||
|
|
||||||
|
|
||||||
$test = get_term_by('id', 12, 'category');
|
$archiveQuestions = get_page_by_template('template-archive-questions.php')[0];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// echo '<pre>';
|
|
||||||
// print_r($thematique_related_page);
|
|
||||||
// echo '</pre>';
|
|
||||||
|
|
||||||
|
|
||||||
// echo $the_query->posts[0]->post_content;
|
|
||||||
?>
|
?>
|
||||||
<div class="breadcrumb-thematiques">
|
|
||||||
<ul>
|
|
||||||
|
<nav class="breadcrumbs_navigation" aria-label="breadcrumbs">
|
||||||
|
<ol>
|
||||||
|
<li><a href="<?php echo home_url() ?>">Home</a></li>
|
||||||
|
<li><a href="<?php echo get_post_permalink($archiveQuestions) ?>"><?php echo $archiveQuestions->post_title ?></a></li>
|
||||||
|
|
||||||
<li>
|
<li>
|
||||||
<a href="">Home ></a>
|
<a href="<?php echo get_term_link($thematique_generale) ?>" aria-current='location'><?php echo $thematique_generale->name ?></a>
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href="<?php echo get_term_link($thematique_generale) ?>"><?php echo $thematique_generale->name ?></a>
|
|
||||||
</li>
|
</li>
|
||||||
<?php if ($current_children_thematique) : ?>
|
<?php if ($current_children_thematique) : ?>
|
||||||
<li>
|
<li>
|
||||||
|
|
@ -64,10 +44,8 @@ $test = get_term_by('id', 12, 'category');
|
||||||
</li>
|
</li>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
</ul>
|
</ol>
|
||||||
|
</nav>
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="list_filters">
|
<div class="list_filters">
|
||||||
<?php if ($thematique->parent) : ?>
|
<?php if ($thematique->parent) : ?>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user