fix: replacement des catégories apr le roman pour les chapitres de roman
This commit is contained in:
parent
3e1ff55abe
commit
4b10a0e515
3 changed files with 31 additions and 8 deletions
|
@ -1,10 +1,20 @@
|
||||||
<div class="flex-that">
|
<div class="flex-that">
|
||||||
<nav aria-label="breadcrumb">
|
<nav aria-label="breadcrumb">
|
||||||
<ol class="breadcrumb">
|
<ol class="breadcrumb">
|
||||||
<li class='breadcrumb-item'><a href='<?php echo site_url(); ?>'>kazhnuz.space</a></li><?php $categories = get_the_category();
|
<li class='breadcrumb-item'><a href='<?php echo site_url(); ?>'>kazhnuz.space</a></li><?php
|
||||||
|
if (has_category('chapters')) {
|
||||||
|
$romans = get_the_terms($post->ID, 'roman');
|
||||||
|
foreach( $romans as $roman ) {
|
||||||
|
echo "<li class='breadcrumb-item'><a href='" . esc_url( get_category_link( $roman->term_id ) ) . "'><i class='fa fa-book'></i> " . $roman->name . "</a></li>";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$categories = get_the_category();
|
||||||
foreach( $categories as $category ) {
|
foreach( $categories as $category ) {
|
||||||
echo "<li class='breadcrumb-item'><a href='" . esc_url( get_category_link( $category->term_id ) ) . "'><i class='fa fa-folder-open'></i> " . $category->cat_name . "</a></li>";
|
echo "<li class='breadcrumb-item'><a href='" . esc_url( get_category_link( $category->term_id ) ) . "'><i class='fa fa-folder-open'></i> " . $category->cat_name . "</a></li>";
|
||||||
} ?><li class="breadcrumb-item" aria-current="page"><span class="active"><i class="fa fa-file"></i> <?php echo the_title(); ?></span></li>
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
?><li class="breadcrumb-item" aria-current="page"><span class="active"><i class="fa fa-file"></i> <?php echo the_title(); ?></span></li>
|
||||||
</ol>
|
</ol>
|
||||||
</nav>
|
</nav>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,9 +1,15 @@
|
||||||
<?php
|
<?php
|
||||||
|
if (has_category('chapters')) {
|
||||||
|
$romans = get_the_terms($post->ID, 'roman');
|
||||||
|
foreach( $romans as $roman ) {
|
||||||
|
echo "<a href= '" . esc_url( get_category_link( $roman->term_id ) ) . "' class='btn-small btn-info'><i class='fa fa-book'></i> " . $roman->name . "</a>";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
$categories = get_the_category();
|
$categories = get_the_category();
|
||||||
foreach( $categories as $category ) {
|
foreach( $categories as $category ) {
|
||||||
echo "<a href= '" . esc_url( get_category_link( $category->term_id ) ) . "' class='btn-small btn-info'><i class='fa fa-folder'></i> " . $category->cat_name . "</a>";
|
echo "<a href= '" . esc_url( get_category_link( $category->term_id ) ) . "' class='btn-small btn-info'><i class='fa fa-folder'></i> " . $category->cat_name . "</a>";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
$tags = get_the_tags();
|
$tags = get_the_tags();
|
||||||
if ($tags) {
|
if ($tags) {
|
||||||
foreach( $tags as $tag ) {
|
foreach( $tags as $tag ) {
|
||||||
|
|
|
@ -9,8 +9,15 @@
|
||||||
<h1 class="card-header"><?php the_title(); ?></h1>
|
<h1 class="card-header"><?php the_title(); ?></h1>
|
||||||
<div class="preview-metadata">
|
<div class="preview-metadata">
|
||||||
<div class="metadata-pills">
|
<div class="metadata-pills">
|
||||||
<div><?php $category = get_the_category();
|
<div><?php
|
||||||
echo"<span class='btn-small btn-info small-text'>" . $category[0]->cat_name . "</span>"; ?></div>
|
if (!has_category('chapters')) {
|
||||||
|
$category = get_the_category();
|
||||||
|
echo"<span class='btn-small btn-info small-text'>" . $category[0]->cat_name . "</span>";
|
||||||
|
} else {
|
||||||
|
$romans = get_the_terms($post->ID, 'roman');
|
||||||
|
echo"<span class='btn-small btn-info small-text'>" . $romans[0]->name . "</span>";
|
||||||
|
}
|
||||||
|
?></div>
|
||||||
<div><time><span class="btn-small btn-info small-text"><?php the_time('d/m/Y') ?></span></time></div>
|
<div><time><span class="btn-small btn-info small-text"><?php the_time('d/m/Y') ?></span></time></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="comment-text"><?php comments_number('Pas de commentaire', 'Un commentaire', '% commentaires' );?></div>
|
<div class="comment-text"><?php comments_number('Pas de commentaire', 'Un commentaire', '% commentaires' );?></div>
|
||||||
|
|
Reference in a new issue