improvement: utilisation d'une sidebar custom

This commit is contained in:
Kazhnuz 2020-12-30 21:27:12 +01:00
parent 4ba652bf17
commit e8fa8693d1
13 changed files with 129 additions and 41 deletions

View file

@ -1,17 +1,23 @@
<?php get_header(); ?> <!-- ouvrir header,php -->
<main class="col-md-8">
<h1 class="page-title page-title-flex">
<span><i class="fa fa-fw fa-folder"></i> <?php echo single_cat_title(); ?></span>
<?php
$category = get_category( get_query_var( 'cat' ) );
$cat_id = $category->cat_ID;
echo '<a href="' . get_category_link( $cat_id ) . 'feed/" title="RSS de la categorie" />' . '<i class="fa fa-fw fa-rss"></i></a>' ;
?>
</h1>
$cat_id = $category->cat_ID; ?>
<?php include(TEMPLATEPATH . '/components/posts-list.php'); ?>
</main>
<?php get_sidebar(); ?>
<!-- Sidebar custom pour contenir la description -->
<aside class="sidebar">
<div class="card card-info">
<div class="card-header"><i class="fa fa-folder-open"></i> <?php echo single_cat_title(); ?></div>
<div class="card-body">
<?php the_archive_description() ?>
<p><? echo '<a href="' . get_category_link( $cat_id ) . 'feed/" title="RSS de la categorie" />Flux RSS</a> de la categorie'; ?></p>
</div>
</div>
<?php include(TEMPLATEPATH . '/components/sidebar-content.php'); ?>
</aside>
<?php get_footer(); ?>

View file

@ -0,0 +1,5 @@
<?php include(TEMPLATEPATH . '/components/sidebar/last-articles.php'); ?>
<?php include(TEMPLATEPATH . '/components/sidebar/categories.php'); ?>
<?php include(TEMPLATEPATH . '/components/sidebar/tags.php'); ?>
<?php include(TEMPLATEPATH . '/components/sidebar/archives.php'); ?>
<?php include(TEMPLATEPATH . '/components/sidebar/links.php'); ?>

View file

@ -0,0 +1,12 @@
<div class="card card-primary">
<div class="card-header"><i class="fa fa-folder"></i> Archives</div>
<div class="card-menu">
<?php
wp_get_archives( array(
'type' => 'yearly',
'echo' => 1,
'order'=> 'ASC'
) );
?>
</div>
</div>

View file

@ -0,0 +1,14 @@
<div class="card card-primary">
<div class="card-header"><i class="fa fa-folder"></i> Catégories</div>
<div class="card-menu">
<?php
$categories = get_categories( array(
'orderby' => 'name',
'order' => 'ASC'
) );
foreach( $categories as $category ) {
echo '<a class="menu-element" href="' . get_category_link($category->term_id) . '">' . $category->name . '<span class="menu-label label-secondary">'. $category->count . '</span></a>';
}?>
</div>
</div>

View file

@ -0,0 +1,13 @@
<div class="card card-primary">
<div class="card-header"><i class="fa fa-rss"></i> Publications</div>
<div class="card-menu">
<?php
wp_get_archives( array(
'type' => 'postbypost',
'echo' => 1,
'order' => 'ASC',
'limit' => 6
) );
?>
</div>
</div>

View file

@ -0,0 +1,10 @@
<div class="card card-primary">
<div class="card-header"><i class="fa fa-link"></i> Liens</div>
<div class="card-menu">
<a href="https://kobold.city" class="menu-element">Kobold City</a>
<a href="https://rulebook.kobold.city" class="menu-element">Mes JDR</a>
<a href="https://univers.kobold.city" class="menu-element">Mes Univers</a>
<a href="https://git.kobold.city" class="menu-element">Mon Gitea</a>
<a href="https://vault.kobold.city" class="menu-element">Vault</a>
</div>
</div>

View file

@ -0,0 +1,24 @@
<?php
$args = array(
'smallest' => 8, 'largest' => 22, 'unit' => 'pt', 'number' => 999,
'format' => 'array', 'orderby' => 'name', 'order' => 'ASC',
'exclude' => '', 'include' => '');
$tags = get_tags($args);
?>
<div class="card card-primary">
<div class="card-header"><i class="fa fa-tags"></i> Tags</div>
<div class="card-body">
<form action="<?php bloginfo('url'); ?>" method="get">
<select class="card-select select" id="select-of-tags" name="tag" onchange="if(this.selectedIndex){location.href=(this.options[selectedIndex].value)}">
<option value="">Selection d'un tag...</option>
<?php foreach ($tags as $tag) {?>
<option value="<?php bloginfo('url'); ?>/tag/<?php echo $tag->slug ?>"><?php echo $tag->name ?></option>
<?php } ?>
</select>
</form>
</div>
</div>

View file

@ -10,7 +10,7 @@
if ( function_exists('register_sidebar') )
register_sidebar(array(
'before_widget' => '<section id="%1$s" class="widget %2$s card card-secondary">',
'before_widget' => '<section id="%1$s" class="widget %2$s card card-primary">',
'after_widget' => '</section>',
'before_title' => '<div class="section card-header"><h1>',
'after_title' => '</h1></div>',

View file

@ -169,7 +169,7 @@ $card-smallpad: $lineheight_half;
}
}
ul.card-list {
ul.card-list, .card > ul {
padding:0;
margin:0;
li.list-element {

View file

@ -1,3 +1,3 @@
<aside class="sidebar col-md-4">
<?php dynamic_sidebar(); ?>
<aside class="sidebar">
<?php include(TEMPLATEPATH . '/components/sidebar-content.php'); ?>
</aside>

View file

@ -1023,10 +1023,10 @@ ul.social {
padding-bottom: 0.375rem; }
/* CARD LIST - Make a list part of a card */
ul.card-list {
ul.card-list, .card > ul {
padding: 0;
margin: 0; }
ul.card-list li.list-element {
ul.card-list li.list-element, .card > ul li.list-element {
line-height: 1.5rem;
padding-right: 0.75rem;
padding-left: 0.375rem;

24
tag.php
View file

@ -1,16 +1,20 @@
<?php get_header(); ?> <!-- ouvrir header,php -->
<main class="col-md-8">
<h1 class="page-title page-title-flex">
<span><i class="fa fa-fw fa-tag"></i> <?php echo single_cat_title(); ?></span>
<?php
$tag = get_category( get_query_var( 'tag' ) );
$tag_id = $tag->ID;
echo '<a href="' . get_tag_link( $tag_id ) . 'feed/" title="RSS de la categorie" />' . '<i class="fa fa-fw fa-rss"></i></a>' ;
?>
</h1>
<?php $tag = get_category( get_query_var( 'tag' ) );
$tag_id = $tag->ID;?>
<?php include(TEMPLATEPATH . '/components/posts-list.php'); ?>
</main>
<?php get_sidebar(); ?>
<!-- Sidebar custom pour contenir la description -->
<aside class="sidebar">
<div class="card card-info">
<div class="card-header"><i class="fa fa-fw fa-tag"></i> <?php echo single_cat_title(); ?></div>
<div class="card-body">
<p>Tout les éléments enregistré pour le tag <?php echo single_cat_title(); ?></p>
<p><? echo '<a href="' . get_tag_link( $tag_id ) . 'feed/" title="RSS du tag" />Flux RSS</a> du tag'; ?></p>
</div>
</div>
<?php include(TEMPLATEPATH . '/components/sidebar-content.php'); ?>
</aside>
<?php get_footer(); ?>