chore: split article template

This commit is contained in:
Kazhnuz 2021-01-04 12:00:40 +01:00
parent 4dfaa90630
commit fd5d3a7e5f
5 changed files with 45 additions and 41 deletions

View file

@ -1,26 +1,7 @@
<div class="flex-that"> <?php include(TEMPLATEPATH . '/components/article/breadcrumb.php'); ?>
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class='breadcrumb-item'><a href='<?php echo site_url(); ?>'>kazhnuz.space</a></li><?php $categories = get_the_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>";
} ?><li class="breadcrumb-item" aria-current="page"><span class="active"><i class="fa fa-file"></i> <?php echo the_title(); ?></span></li>
</ol>
</nav>
</div>
<?php if(have_posts()) : ?><?php while(have_posts()) : the_post(); ?> <?php if(have_posts()) : ?><?php while(have_posts()) : the_post(); ?>
<?php $flags = get_the_terms($post->ID, 'flag'); <?php include(TEMPLATEPATH . '/components/article/flags.php'); ?>
if ($flags) {
foreach( $flags as $flag ) {
$term_meta = get_option( "taxonomy_term_$flag->term_id" );
echo "<div class='toast toast-" . $term_meta['niveau'] . "'>";
echo $flag->description;
echo "</div>";
}
} ?>
<article class="article container-article" id="post-<?php the_ID(); ?>"> <article class="article container-article" id="post-<?php the_ID(); ?>">
<?php if ($haveTitle) { ?> <?php if ($haveTitle) { ?>
@ -40,29 +21,11 @@ if ($flags) {
<small class="author-date">Le <?php the_time('l j F Y à H:i') ?></small> <small class="author-date">Le <?php the_time('l j F Y à H:i') ?></small>
</div> </div>
</div> </div>
<?php
$custom_fields = get_post_custom();
$my_custom_field = $custom_fields['description'];
if ($my_custom_field != null) {
foreach ( $my_custom_field as $key => $value ) {
echo " <div class='card-body'> " . $value . "</div>";
}
} <?php include(TEMPLATEPATH . '/components/article/description.php'); ?>
?>
<div class="article-category"> <div class="article-category">
<?php $categories = get_the_category(); <?php include(TEMPLATEPATH . '/components/article/terms.php'); ?>
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>";
} ?>
<?php $tags = get_the_tags();
if ($tags) {
foreach( $tags as $tag ) {
echo "<a href= '" . esc_url( get_tag_link( $tag->term_id ) ) . "' class='btn-small btn-primary'><i class='fa fa-tag'></i> " . $tag->name . "</a> ";
}
} ?>
</div> </div>
</section> </section>

View file

@ -0,0 +1,10 @@
<div class="flex-that">
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class='breadcrumb-item'><a href='<?php echo site_url(); ?>'>kazhnuz.space</a></li><?php $categories = get_the_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>";
} ?><li class="breadcrumb-item" aria-current="page"><span class="active"><i class="fa fa-file"></i> <?php echo the_title(); ?></span></li>
</ol>
</nav>
</div>

View file

@ -0,0 +1,9 @@
<?php
$custom_fields = get_post_custom();
$my_custom_field = $custom_fields['description'];
if ($my_custom_field != null) {
foreach ( $my_custom_field as $key => $value ) {
echo " <div class='card-body'> " . $value . "</div>";
}
}
?>

View file

@ -0,0 +1,9 @@
<?php $flags = get_the_terms($post->ID, 'flag');
if ($flags) {
foreach( $flags as $flag ) {
$term_meta = get_option( "taxonomy_term_$flag->term_id" );
echo "<div class='toast toast-" . $term_meta['niveau'] . "'>";
echo $flag->description;
echo "</div>";
}
} ?>

View file

@ -0,0 +1,13 @@
<?php
$categories = get_the_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>";
}
$tags = get_the_tags();
if ($tags) {
foreach( $tags as $tag ) {
echo "<a href= '" . esc_url( get_tag_link( $tag->term_id ) ) . "' class='btn-small btn-primary'><i class='fa fa-tag'></i> " . $tag->name . "</a> ";
}
}
?>