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,7 +1,7 @@
<?php get_header(); ?> <!-- ouvrir header,php -->
<main class="col-md-8">
<h1 class="page-title"><?php echo get_the_archive_title(); ?></h1>
<?php include(TEMPLATEPATH . '/components/posts-list.php'); ?>
</main>
<?php get_sidebar(); ?>

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>
<?php
$category = get_category( get_query_var( 'cat' ) );
$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

@ -1,21 +1,21 @@
<?php
<?php
/* functions.php
*
* All the function of Quarante-Douze
*
*/
/* 1. Sidebar support */
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>',
));
/* 2. Niveau support (for featured posts) */
register_taxonomy(
@ -58,20 +58,20 @@ function mypost_social_sharing_buttons($content) {
// Fork of mypost_social_sharing_buttons
// You can find the original at the following url:
// https://mypost_.com/how-to-create-social-sharing-button-without-any-plugin-and-script-loading-wordpress-speed-optimization-goal/
global $post;
if(is_singular() || is_home()){
// Get current page URL
// Get current page URL
$mypost_URL = urlencode(get_permalink());
// Get current page title
$mypost_Title = htmlspecialchars(urlencode(html_entity_decode(get_the_title(), ENT_COMPAT, 'UTF-8')), ENT_COMPAT, 'UTF-8');
// $mypost_Title = str_replace( ' ', '%20', get_the_title());
// Get Post Thumbnail for pinterest
$mypost_Thumbnail = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' );
// Construct sharing URL without using any script
$twitterURL = 'https://twitter.com/intent/tweet?text='.$mypost_Title.'&amp;url='.$mypost_URL.'&amp;via=mypost_';
$facebookURL = 'https://www.facebook.com/sharer/sharer.php?u='.$mypost_URL;
@ -79,10 +79,10 @@ function mypost_social_sharing_buttons($content) {
$whatsappURL = 'whatsapp://send?text='.$mypost_Title . ' ' . $mypost_URL;
$linkedInURL = 'https://www.linkedin.com/shareArticle?mini=true&url='.$mypost_URL.'&amp;title='.$mypost_Title;
$diasporaURL = 'http://sharetodiaspora.github.io/?title=' . $mypost_Title . '&url=' . $mypost_URL;
// Based on popular demand added Pinterest too
$pinterestURL = 'https://pinterest.com/pin/create/button/?url='.$mypost_URL.'&amp;media='.$mypost_Thumbnail[0].'&amp;description='.$mypost_Title;
// Add sharing button at the end of page/page content
$content .= '<!-- based on crunchify social sharing. Get your copy here: http://crunchify.me/1VIxAsz -->';
$content .= '<div class="reagir share-buttons">';
@ -94,7 +94,7 @@ function mypost_social_sharing_buttons($content) {
$content .= '<a class="btn btn-linkedin" href="'.$linkedInURL.'" target="_blank"><i alt="linkedin" class="fa fa-fw fa-linkedin"></i></a>';
$content .= '<a class="btn btn-pinterest" href="'.$pinterestURL.'" data-pin-custom="true" target="_blank"><i alt="Pin It" class="fa fa-fw fa-pinterest"></i></a>';
$content .= '</div>';
return $content;
}else{
// if not a post/page then don't include sharing button

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

@ -190,7 +190,7 @@ blockquote, pre {
*
*/
/* 2.1 - Font Face */
/* 2.1.1 - OpenSans
/* 2.1.1 - OpenSans
@font-face {
font-family: 'OpenSans';
@ -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;

26
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(); ?>