FEAT: Nouveau design avec menu principal en haut et menu latéral à gauche - v1.3.0
This commit is contained in:
+13
-56
@@ -1,15 +1,20 @@
|
||||
<?php
|
||||
// Enregistrement des menus
|
||||
// Configuration de base
|
||||
function wp_theme_sen2_setup() {
|
||||
// Enregistrement des menus
|
||||
register_nav_menus(array(
|
||||
'primary' => 'Menu Principal',
|
||||
'primary' => __('Menu Principal', 'wp-theme-sen2'), // Menu principal en haut
|
||||
'secondary' => __('Menu Latéral', 'wp-theme-sen2') // Menu secondaire à gauche
|
||||
));
|
||||
|
||||
// Supports du thème
|
||||
add_theme_support('post-thumbnails');
|
||||
add_theme_support('title-tag');
|
||||
add_theme_support('automatic-feed-links');
|
||||
}
|
||||
add_action('after_setup_theme', 'wp_theme_sen2_setup');
|
||||
|
||||
// Ajout des feuilles de style et scripts
|
||||
// Chargement des scripts et styles
|
||||
function wp_theme_sen2_scripts() {
|
||||
wp_enqueue_style('wp-theme-sen2-style', get_stylesheet_uri());
|
||||
wp_enqueue_style('wp-theme-sen2-google-fonts', 'https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600&display=swap');
|
||||
@@ -19,21 +24,19 @@ add_action('wp_enqueue_scripts', 'wp_theme_sen2_scripts');
|
||||
|
||||
// Custom Post Type pour Portfolio
|
||||
function wp_theme_sen2_custom_post_type() {
|
||||
register_post_type('portfolio',
|
||||
array(
|
||||
register_post_type('portfolio', array(
|
||||
'labels' => array(
|
||||
'name' => 'Portfolio',
|
||||
'singular_name' => 'Projet'
|
||||
'name' => __('Portfolio', 'wp-theme-sen2'),
|
||||
'singular_name' => __('Projet', 'wp-theme-sen2')
|
||||
),
|
||||
'public' => true,
|
||||
'has_archive' => true,
|
||||
'supports' => array('title', 'editor', 'thumbnail'),
|
||||
)
|
||||
);
|
||||
));
|
||||
}
|
||||
add_action('init', 'wp_theme_sen2_custom_post_type');
|
||||
|
||||
// Ajout d'une section "Slogan" dans le Customizer
|
||||
// Personnalisation du slogan via Customizer
|
||||
function wp_theme_sen2_customize_register($wp_customize) {
|
||||
$wp_customize->add_section('wp_theme_sen2_slogan_section', array(
|
||||
'title' => __('Slogan du site', 'wp-theme-sen2'),
|
||||
@@ -48,54 +51,8 @@ function wp_theme_sen2_customize_register($wp_customize) {
|
||||
$wp_customize->add_control('wp_theme_sen2_slogan_control', array(
|
||||
'label' => __('Slogan', 'wp-theme-sen2'),
|
||||
'section' => 'wp_theme_sen2_slogan_section',
|
||||
'settings' => 'wp_theme_sen2_slogan',
|
||||
'type' => 'text',
|
||||
));
|
||||
|
||||
$wp_customize->add_setting('wp_theme_sen2_show_slogan', array(
|
||||
'default' => true,
|
||||
'sanitize_callback' => 'wp_theme_sen2_sanitize_checkbox',
|
||||
));
|
||||
|
||||
$wp_customize->add_control('wp_theme_sen2_show_slogan_control', array(
|
||||
'label' => __('Afficher le slogan', 'wp-theme-sen2'),
|
||||
'section' => 'wp_theme_sen2_slogan_section',
|
||||
'settings' => 'wp_theme_sen2_show_slogan',
|
||||
'type' => 'checkbox',
|
||||
));
|
||||
}
|
||||
add_action('customize_register', 'wp_theme_sen2_customize_register');
|
||||
|
||||
function wp_theme_sen2_sanitize_checkbox($checked) {
|
||||
return (isset($checked) && $checked === true) ? true : false;
|
||||
}
|
||||
|
||||
// Mise à jour automatique via Gitea
|
||||
add_filter('site_transient_update_themes', 'wp_theme_sen2_check_for_updates');
|
||||
function wp_theme_sen2_check_for_updates($transient) {
|
||||
if (empty($transient->checked)) return $transient;
|
||||
|
||||
$theme_data = wp_get_theme('wp-theme-sen2');
|
||||
$current_version = $theme_data->get('Version');
|
||||
|
||||
$remote_style_css = 'http://gitea.sen2.lab/admnh/wp-theme-sen2/raw/branch/main/style.css';
|
||||
$remote_data = wp_remote_get($remote_style_css, array(
|
||||
'sslverify' => false,
|
||||
));
|
||||
|
||||
if (!is_wp_error($remote_data) && $remote_data['response']['code'] === 200) {
|
||||
preg_match('/Version:\s*(.*)/i', $remote_data['body'], $matches);
|
||||
$remote_version = $matches[1] ?? null;
|
||||
|
||||
if ($remote_version && version_compare($current_version, $remote_version, '<')) {
|
||||
$transient->response['wp-theme-sen2'] = array(
|
||||
'theme' => 'wp-theme-sen2',
|
||||
'new_version' => $remote_version,
|
||||
'url' => 'http://gitea.sen2.lab/admnh/wp-theme-sen2',
|
||||
'package' => 'http://gitea.sen2.lab/admnh/wp-theme-sen2/archive/main.zip',
|
||||
);
|
||||
}
|
||||
}
|
||||
return $transient;
|
||||
}
|
||||
?>
|
||||
+20
-3
@@ -9,6 +9,25 @@
|
||||
</head>
|
||||
<body <?php body_class(); ?>>
|
||||
<header class="container">
|
||||
<!-- Menu principal centré en haut -->
|
||||
<nav class="main-navigation">
|
||||
<?php wp_nav_menu(array('theme_location' => 'primary')); ?>
|
||||
</nav>
|
||||
|
||||
<div class="header-content">
|
||||
<!-- Menu secondaire à gauche -->
|
||||
<nav class="secondary-navigation">
|
||||
<?php
|
||||
wp_nav_menu(array(
|
||||
'theme_location' => 'secondary',
|
||||
'fallback_cb' => false,
|
||||
'depth' => 1,
|
||||
'container' => false
|
||||
));
|
||||
?>
|
||||
</nav>
|
||||
|
||||
<!-- Logo centré -->
|
||||
<div class="site-branding">
|
||||
<h1 class="site-title">
|
||||
<a href="<?php echo home_url(); ?>"><?php bloginfo('name'); ?></a>
|
||||
@@ -17,7 +36,5 @@
|
||||
<?php endif; ?>
|
||||
</h1>
|
||||
</div>
|
||||
<nav class="main-navigation">
|
||||
<?php wp_nav_menu(array('theme_location' => 'primary')); ?>
|
||||
</nav>
|
||||
</div>
|
||||
</header>
|
||||
@@ -1,12 +1,6 @@
|
||||
/*
|
||||
Theme Name: WP Theme SEN2
|
||||
Theme URI: https://ton-site.com/wp-theme-sen2
|
||||
Author: Nicolas Houzeau
|
||||
Author URI: https://ton-site.com
|
||||
Description: Un thème sobre et moderne pour portfolio photo, en blanc cassé. Compatible avec Envira Gallery et personnalisable via le Customizer.
|
||||
Version: 1.0.0
|
||||
License: GNU General Public License v2 or later
|
||||
Text Domain: wp-theme-sen2
|
||||
Version: 1.3.0
|
||||
*/
|
||||
|
||||
/* Réinitialisation et base */
|
||||
@@ -17,17 +11,6 @@ body {
|
||||
line-height: 1.6;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #555555;
|
||||
text-decoration: none;
|
||||
transition: color 0.3s ease;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
color: #E1306C;
|
||||
}
|
||||
|
||||
.container {
|
||||
@@ -36,46 +19,25 @@ a:hover {
|
||||
padding: 0 20px;
|
||||
}
|
||||
|
||||
/* Header et slogan */
|
||||
/* Header et navigation */
|
||||
header {
|
||||
background-color: #F9F9F9;
|
||||
padding: 30px 0;
|
||||
border-bottom: 1px solid #EEEEEE;
|
||||
padding: 20px 0;
|
||||
}
|
||||
|
||||
.site-branding {
|
||||
.main-navigation {
|
||||
text-align: center;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.site-title {
|
||||
margin: 0;
|
||||
font-size: 24px;
|
||||
font-weight: 600;
|
||||
color: #333333;
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
.site-title a {
|
||||
text-decoration: none;
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
.site-slogan {
|
||||
display: block;
|
||||
font-family: 'Montserrat', sans-serif;
|
||||
font-weight: 300;
|
||||
font-size: 16px;
|
||||
color: #555555;
|
||||
letter-spacing: 0.5px;
|
||||
margin-top: 5px;
|
||||
border-bottom: 1px solid #EEEEEE;
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
|
||||
.main-navigation ul {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
display: flex;
|
||||
gap: 20px;
|
||||
justify-content: center;
|
||||
gap: 30px;
|
||||
}
|
||||
|
||||
.main-navigation a {
|
||||
@@ -88,7 +50,88 @@ header {
|
||||
color: #E1306C;
|
||||
}
|
||||
|
||||
/* Footer */
|
||||
.header-content {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.secondary-navigation {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
.site-branding {
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.site-slogan {
|
||||
display: block;
|
||||
font-weight: 300;
|
||||
font-size: 16px;
|
||||
color: #555555;
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
.secondary-navigation ul {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.secondary-navigation li {
|
||||
writing-mode: vertical-rl;
|
||||
text-orientation: mixed;
|
||||
}
|
||||
|
||||
.secondary-navigation a {
|
||||
font-size: 14px;
|
||||
color: #555555;
|
||||
text-decoration: none;
|
||||
transition: color 0.3s ease;
|
||||
}
|
||||
|
||||
.secondary-navigation a:hover {
|
||||
color: #E1306C;
|
||||
}
|
||||
|
||||
/* Responsive */
|
||||
@media (max-width: 768px) {
|
||||
.header-content {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.secondary-navigation {
|
||||
position: static;
|
||||
transform: none;
|
||||
writing-mode: horizontal-tb;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.secondary-navigation ul {
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
.secondary-navigation li {
|
||||
writing-mode: horizontal-tb;
|
||||
text-orientation: initial;
|
||||
}
|
||||
|
||||
.main-navigation ul {
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
}
|
||||
|
||||
/* Footer et autres styles (à conserver) */
|
||||
footer {
|
||||
background-color: #F9F9F9;
|
||||
padding: 20px 0;
|
||||
@@ -97,101 +140,4 @@ footer {
|
||||
margin-top: 40px;
|
||||
}
|
||||
|
||||
.social-icons {
|
||||
margin: 20px 0;
|
||||
}
|
||||
|
||||
.instagram-icon {
|
||||
color: #333333;
|
||||
font-size: 24px;
|
||||
transition: color 0.3s ease;
|
||||
}
|
||||
|
||||
.instagram-icon:hover {
|
||||
color: #E1306C;
|
||||
}
|
||||
|
||||
/* Galeries Envira */
|
||||
.envira-gallery-wrap {
|
||||
background-color: #F9F9F9;
|
||||
padding: 20px;
|
||||
border-radius: 4px;
|
||||
margin: 2em 0;
|
||||
}
|
||||
|
||||
.envira-gallery-item {
|
||||
transition: transform 0.3s ease, opacity 0.3s ease;
|
||||
}
|
||||
|
||||
.envira-gallery-item:hover {
|
||||
transform: scale(1.03);
|
||||
opacity: 0.9;
|
||||
}
|
||||
|
||||
/* Formulaire de contact */
|
||||
.wpforms-container {
|
||||
max-width: 600px;
|
||||
margin: 0 auto;
|
||||
padding: 20px;
|
||||
background-color: #FFFFFF;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
|
||||
.wpforms-submit {
|
||||
background-color: #333333;
|
||||
color: #FFFFFF;
|
||||
border: none;
|
||||
padding: 12px 24px;
|
||||
border-radius: 4px;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.wpforms-submit:hover {
|
||||
background-color: #E1306C;
|
||||
}
|
||||
|
||||
/* Page À propos */
|
||||
.about-banner {
|
||||
text-align: center;
|
||||
padding: 60px 20px;
|
||||
background-color: #F5F5F5;
|
||||
margin-bottom: 40px;
|
||||
}
|
||||
|
||||
.about-banner h1 {
|
||||
font-size: 36px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.about-content {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 40px;
|
||||
margin-bottom: 40px;
|
||||
}
|
||||
|
||||
.about-text {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.about-image {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.about-image img {
|
||||
width: 100%;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
/* Responsive */
|
||||
@media (max-width: 768px) {
|
||||
.about-content {
|
||||
flex-direction: column;
|
||||
}
|
||||
.about-banner h1 {
|
||||
font-size: 28px;
|
||||
}
|
||||
}
|
||||
/* Le reste de ton CSS existant... */
|
||||
Reference in New Issue
Block a user