chore: split article template
This commit is contained in:
parent
4dfaa90630
commit
fd5d3a7e5f
5 changed files with 45 additions and 41 deletions
|
@ -1,26 +1,7 @@
|
|||
<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>
|
||||
|
||||
<?php include(TEMPLATEPATH . '/components/article/breadcrumb.php'); ?>
|
||||
<?php if(have_posts()) : ?><?php while(have_posts()) : the_post(); ?>
|
||||
|
||||
<?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>";
|
||||
}
|
||||
} ?>
|
||||
|
||||
<?php include(TEMPLATEPATH . '/components/article/flags.php'); ?>
|
||||
|
||||
<article class="article container-article" id="post-<?php the_ID(); ?>">
|
||||
<?php if ($haveTitle) { ?>
|
||||
|
@ -40,29 +21,11 @@ if ($flags) {
|
|||
<small class="author-date">Le <?php the_time('l j F Y à H:i') ?></small>
|
||||
</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">
|
||||
<?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>";
|
||||
} ?>
|
||||
<?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> ";
|
||||
}
|
||||
} ?>
|
||||
|
||||
<?php include(TEMPLATEPATH . '/components/article/terms.php'); ?>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
|
10
components/article/breadcrumb.php
Normal file
10
components/article/breadcrumb.php
Normal 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>
|
9
components/article/description.php
Normal file
9
components/article/description.php
Normal 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>";
|
||||
}
|
||||
}
|
||||
?>
|
9
components/article/flags.php
Normal file
9
components/article/flags.php
Normal 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>";
|
||||
}
|
||||
} ?>
|
13
components/article/terms.php
Normal file
13
components/article/terms.php
Normal 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> ";
|
||||
}
|
||||
}
|
||||
?>
|
Reference in a new issue