introducing parcours hiercarchy and post type
This commit is contained in:
parent
7fad8c9af4
commit
d1c3b69bc0
|
|
@ -193,7 +193,7 @@ function create_posttype()
|
||||||
'show_in_rest' => true,
|
'show_in_rest' => true,
|
||||||
'menu_icon' => 'dashicons-forms',
|
'menu_icon' => 'dashicons-forms',
|
||||||
'supports' => array('title', 'custom-fields'),
|
'supports' => array('title', 'custom-fields'),
|
||||||
'supports' => array('title', 'editor', 'page-attributes', 'thumbnail', 'revision'),
|
'supports' => array('title', 'editor', 'page-attributes', 'thumbnail', 'revision', 'excerpt'),
|
||||||
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
|
||||||
18
single-parcours-child.php
Normal file
18
single-parcours-child.php
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
<?php
|
||||||
|
get_header();
|
||||||
|
?>
|
||||||
|
|
||||||
|
|
||||||
|
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
|
||||||
|
<article class="container my-8 mx-auto entry-content single-editor-content <?php echo $thematiqueColorSlug ? "entry-content--" . $thematiqueColorSlug : "" ?>">
|
||||||
|
|
||||||
|
|
||||||
|
<?php the_content() ?>
|
||||||
|
</article>
|
||||||
|
<?php endwhile; ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<?php
|
||||||
|
get_footer();
|
||||||
33
single-parcours-parent.php
Normal file
33
single-parcours-parent.php
Normal file
|
|
@ -0,0 +1,33 @@
|
||||||
|
<?php
|
||||||
|
get_header();
|
||||||
|
?>
|
||||||
|
|
||||||
|
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
|
||||||
|
<article class="container my-8 mx-auto entry-content single-editor-content <?php echo $thematiqueColorSlug ? "entry-content--" . $thematiqueColorSlug : "" ?>">
|
||||||
|
<h1>parent</h1>
|
||||||
|
<!-- CHAPTER INDEX -->
|
||||||
|
<aside class="chapter_index">
|
||||||
|
<?php if ($chapterBlockIndex) : ?>
|
||||||
|
<div class="chapter_index__titling">
|
||||||
|
<div class="icon">
|
||||||
|
<img src="<?php echo get_template_directory_uri() . '/resources/img/graphic-assets/icon-feather-menu.svg' ?>" alt="">
|
||||||
|
</div>
|
||||||
|
<h2 class="chapter_index__title"> <?php echo __("Dans ce conseil", "homegrade-theme__texte-fonctionnel") ?> </h2>
|
||||||
|
</div>
|
||||||
|
<ul class="chapter_index__list">
|
||||||
|
<div class="chapter_index__position-indicator"></div>
|
||||||
|
<?php foreach ($chapterBlockIndex as $chapter) : ?>
|
||||||
|
<li class="chapter_index__link"><a href="<?php echo $chapter['anchor'] ?>"><?php echo $chapter['title'] ?></a></li>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</ul>
|
||||||
|
<?php endif; ?>
|
||||||
|
</aside>
|
||||||
|
<?php the_content() ?>
|
||||||
|
</article>
|
||||||
|
<?php endwhile; ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<?php
|
||||||
|
get_footer();
|
||||||
|
|
@ -1,23 +1,9 @@
|
||||||
<?php
|
<?php
|
||||||
get_header();
|
$isParentPage = get_queried_object()->post_parent === 0;
|
||||||
?>
|
|
||||||
|
|
||||||
|
|
||||||
<?php if (have_posts()) : ?>
|
if ($isParentPage) {
|
||||||
<?php
|
get_template_part('single-parcours-parent');
|
||||||
while (have_posts()) :
|
} else {
|
||||||
the_post();
|
get_template_part('single-parcours-child');
|
||||||
$thematique = get_the_terms(get_the_ID(), 'thematiques')[0];
|
}
|
||||||
$thematiqueParent = getParentThematique($thematique);
|
|
||||||
$thematiqueColorSlug = getThematiqueFamilySlug($thematiqueParent->slug);
|
|
||||||
?>
|
|
||||||
|
|
||||||
<article class="container my-8 mx-auto entry-content single-editor-content <?php echo $thematiqueColorSlug ? "entry-content--" . $thematiqueColorSlug : "" ?>">
|
|
||||||
<?php the_content() ?>
|
|
||||||
</article>
|
|
||||||
<?php endwhile; ?>
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
|
|
||||||
<?php
|
|
||||||
get_footer();
|
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ $parcoursSteps = new WP_Query(array(
|
||||||
<section class="parcours-steps-container">
|
<section class="parcours-steps-container">
|
||||||
|
|
||||||
<?php foreach ($parcoursSteps->posts as $parcoursStep) : ?>
|
<?php foreach ($parcoursSteps->posts as $parcoursStep) : ?>
|
||||||
<div class="step-container">
|
<div class="step-container card">
|
||||||
<?php
|
<?php
|
||||||
$childrenStepPosts = get_posts(array(
|
$childrenStepPosts = get_posts(array(
|
||||||
'post_type' => 'parcours',
|
'post_type' => 'parcours',
|
||||||
|
|
@ -63,9 +63,14 @@ $parcoursSteps = new WP_Query(array(
|
||||||
'post_parent' => $parcoursStep->ID,
|
'post_parent' => $parcoursStep->ID,
|
||||||
));
|
));
|
||||||
?>
|
?>
|
||||||
<h2><?php echo $parcoursStep->post_title ?></h2>
|
<h2><a href="<?php echo get_post_permalink($parcoursStep->ID) ?>"><?php echo $parcoursStep->post_title ?></a>
|
||||||
|
</h2>
|
||||||
<?php foreach ($childrenStepPosts as $childPost) : ?>
|
<?php foreach ($childrenStepPosts as $childPost) : ?>
|
||||||
<p><?php echo $childPost->post_title ?></p>
|
<p>
|
||||||
|
<a href="<?php echo get_post_permalink($childPost->ID) ?>">
|
||||||
|
<?php echo $childPost->post_title ?>
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user