fix: featured

Fixes #55
This commit is contained in:
Kazhnuz 2023-05-20 12:02:34 +02:00
parent 3b1e2eca06
commit 94bb9103cd
9 changed files with 69 additions and 25 deletions

View file

@ -17,8 +17,8 @@
if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
<div class="card card-primary" id="post-<?php the_ID(); ?>">
<div class="card-header"><h1><?php the_title(); ?></h1></div>
<article class="card head-primary" id="post-<?php the_ID(); ?>">
<h1 class="card-header"><?php the_title(); ?></h1>
<div class="flex-that mb">
<div class="article-category">
<?php $category = get_the_category();
@ -28,7 +28,7 @@
</div>
<?php the_excerpt(); ?>
<p class="align-center"> <a href="<?php the_permalink(); ?>" class="btn btn-readmore" title="<?php the_title();?>">Lire l'article</a> </p>
</div>
</article>
<?php endwhile; ?> <?php wp_reset_query(); /*4*/ ?>
</div>

View file

@ -1,7 +1,7 @@
<?php if(have_posts()) : ?>
<div class="preview-grid">
<?php while(have_posts()) : the_post(); ?>
<article class="card card-preview card-primary">
<article class="card card-preview head-primary">
<a href="<?php the_permalink(); ?>" class="preview-link">
<h1 class="card-header"><?php the_title(); ?></h1>
<div class="preview-content">

View file

@ -6,12 +6,14 @@
*/
include(TEMPLATEPATH . '/functions/posts-support.php');
include(TEMPLATEPATH . '/functions/niveaux.php');
include(TEMPLATEPATH . '/functions/flags.php');
include(TEMPLATEPATH . '/functions/breadcrumb.php');
include(TEMPLATEPATH . '/functions/tags-moreinfo.php');
include(TEMPLATEPATH . '/functions/profile-extra-fields.php');
include(TEMPLATEPATH . '/functions/romans.php');
include(TEMPLATEPATH . '/functions/reading-time.php');
include(TEMPLATEPATH . '/functions/cat-template.php');
function wpb_custom_new_menu() {
register_nav_menus(

View file

@ -0,0 +1,30 @@
<?php
// Use a parent category slug if it exists
function child_force_category_template($template) {
$cat = get_query_var('cat');
$category = get_category($cat);
if ( file_exists(TEMPLATEPATH . '/category-' . $category->cat_ID . '.php') ) {
$cat_template = TEMPLATEPATH . '/category-' . $category ->cat_ID . '.php';
} elseif ( file_exists(TEMPLATEPATH . '/category-' . $category->slug . '.php') ) {
$cat_template = TEMPLATEPATH . '/category-' . $category ->slug . '.php';
} elseif ( file_exists(TEMPLATEPATH . '/category-' . $category->category_parent . '.php') ) {
$cat_template = TEMPLATEPATH . '/category-' . $category->category_parent . '.php';
} else {
// Get Parent Slug
$cat_parent = get_category($category->category_parent);
if ( file_exists(TEMPLATEPATH . '/category-' . $cat_parent->slug . '.php') ) {
$cat_template = TEMPLATEPATH . '/category-' . $cat_parent->slug . '.php';
} else {
$cat_template = $template;
}
}
return $cat_template;
}
add_action('category_template', 'child_force_category_template');
?>

30
functions/niveaux.php Normal file
View file

@ -0,0 +1,30 @@
<?php
/////////////////////////////////////////////////////////////////////////////
// Post level support
// Handle featured posts
//
// Version 0.1
register_taxonomy(
'niveau',
'post',
array(
'label' => 'Niveau',
'labels' => array(
'name' => 'Niveaux',
'singular_name' => 'Niveaux',
'all_items' => 'Tous les niveaux',
'edit_item' => 'Éditer le niveau',
'view_item' => 'Voir le niveau',
'update_item' => 'Mettre à jour le niveau',
'add_new_item' => 'Ajouter un niveau',
'new_item_name' => 'Nouveau niveau',
'search_items' => 'Rechercher parmi les niveaux',
'popular_items' => 'Niveaux les plus utilisés'
),
'hierarchical' => false
)
);
register_taxonomy_for_object_type( 'niveau', 'post' );
?>

View file

@ -23,6 +23,7 @@ $card-smallpad: $lineheight_rel / 4;
.fa {
margin-right: 0.5em;
}
font-family: $basefont;
}
}

View file

@ -1,14 +1,3 @@
#featured-articles {
display:grid;
grid-template-columns: 1fr;
grid-template-rows: auto;
grid-gap: $lineheight;
padding-bottom: $lineheight;
@include lg() {
grid-template-columns: 1fr 1fr 1fr;
}
}
.preview-featured {
font-size: 0.8rem;

View file

@ -1382,7 +1382,8 @@ nav.pagination {
z-index: 1;
overflow: visible;
background-color: transparent;
border-radius: 0; }
border-radius: 0;
font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Cantarell, Roboto, Oxygen, Ubuntu, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif; }
.card-header:before {
content: " ";
position: absolute;
@ -2968,15 +2969,6 @@ ul.social {
top: -240px;
margin: auto; } }
#featured-articles {
display: grid;
grid-template-columns: 1fr;
grid-template-rows: auto;
grid-gap: 1.6rem;
padding-bottom: 1.6rem; }
@media (min-width: 992px) {
#featured-articles {
grid-template-columns: 1fr 1fr 1fr; } }
.preview-featured {
font-size: 0.8rem; }
.preview-featured .preview-link {