Compare commits
6 Commits
a247670ab9
...
7b315ce540
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7b315ce540 | ||
|
|
2f043c05fe | ||
|
|
46de3ba8f2 | ||
|
|
3195587c11 | ||
|
|
5ee97117fa | ||
|
|
04c6b2955e |
11
header.php
11
header.php
|
|
@ -92,6 +92,17 @@
|
|||
|
||||
</div>
|
||||
|
||||
<div class="tools-container">
|
||||
<button class="search-button">
|
||||
<img src="<?php echo get_template_directory_uri(); ?>/resources/img/icons/carhop-rechercher.svg" alt="">
|
||||
Rechercher
|
||||
</button>
|
||||
<button class="search-button">
|
||||
<img src="<?php echo get_template_directory_uri(); ?>/resources/img/icons/carhop-abonner.svg" alt="">
|
||||
S’abonner
|
||||
</button>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ add_action('admin_head', 'dynamiques_custom_admin');
|
|||
------------------------------------------------------------------*/
|
||||
function custom_menu_page_removing()
|
||||
{
|
||||
// remove_menu_page('edit.php'); // Hide Articles
|
||||
remove_menu_page('edit.php'); // Hide Articles
|
||||
remove_menu_page('edit-comments.php'); // Hide Commentaires
|
||||
}
|
||||
add_action('admin_menu', 'custom_menu_page_removing');
|
||||
|
|
|
|||
|
|
@ -1,88 +0,0 @@
|
|||
<?php
|
||||
|
||||
/* ------------------------------------------------
|
||||
##### POST TYPES
|
||||
--------------------------------------------------*/
|
||||
function dynamiques_create_posttype()
|
||||
{
|
||||
|
||||
register_post_type(
|
||||
'revues',
|
||||
// CPT Options
|
||||
array(
|
||||
'labels' => array(
|
||||
'name' => __('Revues'),
|
||||
'singular_name' => __('Revue')
|
||||
),
|
||||
'public' => true,
|
||||
'has_archive' => true,
|
||||
'show_in_rest' => true,
|
||||
'menu_icon' => 'data:image/svg+xml;base64,' . base64_encode('<svg width="96" height="74" viewBox="0 0 96 74" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M86.4 2.2C81.6 0.7 76.3 0 71.3 0C62.9 0 53.8 1.7 47.5 6.5C41.2 1.7 32.2 0 23.8 0C15.4 0 6.3 1.7 0 6.5V69.8C0 70.9 1.1 72 2.2 72C3.3 72 2.8 71.8 3.3 71.8C9.1 69 17.6 67 23.8 67C30 67 41.3 68.7 47.6 73.5C53.4 69.8 64 67 71.4 67C78.8 67 85.9 68.3 91.9 71.5C92.3 71.7 92.5 71.7 93 71.7C94.1 71.7 95.2 70.6 95.2 69.5V6.5C92.6 4.6 89.8 3.3 86.6 2.2H86.4ZM86.4 60.5C81.6 59 76.5 58.3 71.3 58.3C64 58.3 53.4 61.1 47.5 64.8V15.1C53.3 11.4 63.9 8.6 71.3 8.6C78.7 8.6 81.7 9.2 86.4 10.8V60.5Z" fill="black"/></svg>'),
|
||||
'menu_position' => 4,
|
||||
'supports' => array(
|
||||
'title',
|
||||
'thumbnail',
|
||||
'excerpt',
|
||||
'custom-fields',
|
||||
'revisions',
|
||||
'author',
|
||||
),
|
||||
|
||||
)
|
||||
);
|
||||
register_post_type(
|
||||
'articles',
|
||||
// CPT Options
|
||||
array(
|
||||
'labels' => array(
|
||||
'name' => __('Articles'),
|
||||
'singular_name' => __('Articles')
|
||||
),
|
||||
'public' => true,
|
||||
'has_archive' => true,
|
||||
'show_in_rest' => true,
|
||||
'menu_icon' => 'dashicons-edit-page',
|
||||
'menu_icon' => 'data:image/svg+xml;base64,' . base64_encode('<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M16 2V16H2V2H16ZM16 0H2C0.9 0 0 0.9 0 2V16C0 17.1 0.9 18 2 18H16C17.1 18 18 17.1 18 16V2C18 0.9 17.1 0 16 0Z" fill="black"/><path d="M11 14H4V12H11V14ZM14 10H4V8H14V10ZM14 6H4V4H14V6Z" fill="black"/></svg>'),
|
||||
'menu_position' => 4,
|
||||
'supports' => array(
|
||||
'title',
|
||||
'editor',
|
||||
'thumbnail',
|
||||
'excerpt',
|
||||
'custom-fields',
|
||||
'revisions',
|
||||
'author',
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
add_action('init', 'dynamiques_create_posttype');
|
||||
|
||||
|
||||
/* ------------------------------------------------
|
||||
##### CHANGE LE NOM DES POSTS PAR ACTUALITES
|
||||
--------------------------------------------------*/
|
||||
function dynamiques_change_post_object()
|
||||
{
|
||||
$get_post_type = get_post_type_object('post');
|
||||
$labels = $get_post_type->labels;
|
||||
$labels->name = 'Actualités';
|
||||
$labels->singular_name = 'Actualité';
|
||||
$labels->add_new = 'Ajouter une actualité';
|
||||
$labels->add_new_item = 'Ajouter une nouvelle actualité';
|
||||
$labels->edit_item = 'Editer l\'actualité';
|
||||
$labels->new_item = 'Actualité';
|
||||
$labels->view_item = 'Voir l\'actualité';
|
||||
$labels->search_items = 'Chercher une actualité';
|
||||
$labels->not_found = 'Pas d\'actualité trouvée';
|
||||
$labels->not_found_in_trash = 'Pas d\'actualité trouvée dans la corbeille';
|
||||
$labels->all_items = 'Toutes les actualités';
|
||||
$labels->menu_name = 'Actualités';
|
||||
$labels->name_admin_bar = 'Actualités';
|
||||
|
||||
// remove_post_type_support('post', 'editor');
|
||||
unregister_taxonomy_for_object_type('category', 'post');
|
||||
unregister_taxonomy_for_object_type('post_tag', 'post');
|
||||
}
|
||||
|
||||
add_action('init', 'dynamiques_change_post_object');
|
||||
|
|
@ -86,7 +86,22 @@ function build_sommaire_from_content($postID)
|
|||
$titleBlocks = array_filter(
|
||||
$blocks,
|
||||
function ($block) {
|
||||
return $block['blockName'] === 'core/heading' && isset($block['attrs']['level']) && in_array($block['attrs']['level'], array(2, 3), true);
|
||||
// Vérifier si c'est un bloc heading
|
||||
if ($block['blockName'] !== 'core/heading') {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Extraire le niveau depuis le HTML si les attributs sont vides
|
||||
if (empty($block['attrs']['level'])) {
|
||||
// Chercher seulement h2 dans le HTML
|
||||
if (preg_match('/<h2[^>]*>/i', $block['innerHTML'], $matches)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Utiliser le niveau des attributs s'il existe
|
||||
return $block['attrs']['level'] === 2;
|
||||
}
|
||||
);
|
||||
|
||||
|
|
@ -94,17 +109,24 @@ function build_sommaire_from_content($postID)
|
|||
|
||||
foreach ($titleBlocks as $block) {
|
||||
$title = strip_tags($block['innerHTML']);
|
||||
|
||||
// Extraire le niveau depuis le HTML ou les attributs
|
||||
$level = $block['attrs']['level'] ?? null;
|
||||
if (!$level && preg_match('/<h2[^>]*>/i', $block['innerHTML'], $matches)) {
|
||||
$level = 2;
|
||||
}
|
||||
|
||||
if ($level !== 2) continue;
|
||||
|
||||
$anchor = $block['attrs']['idName'] ?? sanitize_title($title);
|
||||
$level = $block['attrs']['level'];
|
||||
|
||||
$outputIndex[] = [
|
||||
'title' => $title,
|
||||
'anchor' => $anchor,
|
||||
'level' => $level,
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
|
||||
return $outputIndex;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
.filter-primary {
|
||||
filter: brightness(0) saturate(100%) invert(35%)
|
||||
sepia(26%) saturate(1165%) hue-rotate(123deg)
|
||||
filter: brightness(0) saturate(100%) invert(35%) sepia(26%) saturate(1165%) hue-rotate(123deg)
|
||||
brightness(93%) contrast(93%);
|
||||
}
|
||||
|
||||
.filter-white {
|
||||
filter: brightness(0) saturate(100%) invert(100%);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ $citeReference = get_field('cite_reference', get_the_ID());
|
|||
<?php if ($post_type === 'revues') : ?>
|
||||
<h1 class="post-header__title"> <?php echo $revueTitle; ?></h1>
|
||||
<?php elseif ($post_type === 'articles') : ?>
|
||||
<h2 class="post-header__title"> <?php echo get_the_title(); ?></h2>
|
||||
<h1 class="post-header__title"> <?php echo get_the_title(); ?></h1>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="post-details">
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user