From 94bb9103cda2367e585a61bba09e181851ed4780 Mon Sep 17 00:00:00 2001 From: Kazhnuz Date: Sat, 20 May 2023 12:02:34 +0200 Subject: [PATCH] fix: featured Fixes #55 --- category-blog.php => category-1-blog.php | 0 components/featured.php | 6 ++--- components/preview-list.php | 2 +- functions.php | 2 ++ functions/cat-template.php | 30 ++++++++++++++++++++++++ functions/niveaux.php | 30 ++++++++++++++++++++++++ scss/components/_cards.scss | 1 + scss/custom/_featured.scss | 11 --------- style.css | 12 ++-------- 9 files changed, 69 insertions(+), 25 deletions(-) rename category-blog.php => category-1-blog.php (100%) create mode 100644 functions/cat-template.php create mode 100644 functions/niveaux.php diff --git a/category-blog.php b/category-1-blog.php similarity index 100% rename from category-blog.php rename to category-1-blog.php diff --git a/components/featured.php b/components/featured.php index 5716801..dd74d64 100644 --- a/components/featured.php +++ b/components/featured.php @@ -17,8 +17,8 @@ if ( have_posts() ) while ( have_posts() ) : the_post(); ?> -
-

+
diff --git a/components/preview-list.php b/components/preview-list.php index 685ae36..9104106 100644 --- a/components/preview-list.php +++ b/components/preview-list.php @@ -1,7 +1,7 @@
-
+

diff --git a/functions.php b/functions.php index b645043..8943060 100644 --- a/functions.php +++ b/functions.php @@ -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( diff --git a/functions/cat-template.php b/functions/cat-template.php new file mode 100644 index 0000000..784eed4 --- /dev/null +++ b/functions/cat-template.php @@ -0,0 +1,30 @@ +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'); + +?> \ No newline at end of file diff --git a/functions/niveaux.php b/functions/niveaux.php new file mode 100644 index 0000000..208c7d7 --- /dev/null +++ b/functions/niveaux.php @@ -0,0 +1,30 @@ + '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' ); +?> \ No newline at end of file diff --git a/scss/components/_cards.scss b/scss/components/_cards.scss index 90e8607..c96bb47 100644 --- a/scss/components/_cards.scss +++ b/scss/components/_cards.scss @@ -23,6 +23,7 @@ $card-smallpad: $lineheight_rel / 4; .fa { margin-right: 0.5em; } + font-family: $basefont; } } diff --git a/scss/custom/_featured.scss b/scss/custom/_featured.scss index 8691b7a..8b67fab 100644 --- a/scss/custom/_featured.scss +++ b/scss/custom/_featured.scss @@ -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; diff --git a/style.css b/style.css index 304ae1e..ba27462 100644 --- a/style.css +++ b/style.css @@ -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 {