Compare commits
5 Commits
be36f341e5
...
v1.4.0
| Author | SHA1 | Date | |
|---|---|---|---|
| d5b8237b72 | |||
| 038d0f2743 | |||
| 12a449f64c | |||
| 87ebec0e5f | |||
| 8b7a042189 |
+30
-66
@@ -1,101 +1,65 @@
|
||||
<?php
|
||||
// Enregistrement des menus
|
||||
// Configuration de base
|
||||
function wp_theme_sen2_setup() {
|
||||
// Enregistrement des menus
|
||||
register_nav_menus(array(
|
||||
'primary' => 'Menu Principal',
|
||||
'sidebar' => __('Menu Latéral', 'wp-theme-sen2') // Menu latéral gauche
|
||||
));
|
||||
|
||||
// Supports du thème
|
||||
add_theme_support('post-thumbnails');
|
||||
add_theme_support('title-tag');
|
||||
add_theme_support('automatic-feed-links');
|
||||
add_theme_support('html5', array('search-form', 'comment-form', 'comment-list', 'gallery', 'caption'));
|
||||
|
||||
// Largeur des images pour le thème
|
||||
add_theme_support('align-wide');
|
||||
}
|
||||
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');
|
||||
wp_enqueue_style('wp-theme-sen2-font-awesome', 'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css');
|
||||
|
||||
// Script pour le menu latéral (si besoin)
|
||||
wp_enqueue_script('wp-theme-sen2-script', get_template_directory_uri() . '/js/script.js', array(), '1.0.0', true);
|
||||
}
|
||||
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(
|
||||
'labels' => array(
|
||||
'name' => 'Portfolio',
|
||||
'singular_name' => 'Projet'
|
||||
),
|
||||
'public' => true,
|
||||
'has_archive' => true,
|
||||
'supports' => array('title', 'editor', 'thumbnail'),
|
||||
)
|
||||
);
|
||||
register_post_type('portfolio', array(
|
||||
'labels' => array(
|
||||
'name' => __('Portfolio', 'wp-theme-sen2'),
|
||||
'singular_name' => __('Projet', 'wp-theme-sen2')
|
||||
),
|
||||
'public' => true,
|
||||
'has_archive' => true,
|
||||
'supports' => array('title', 'editor', 'thumbnail'),
|
||||
'rewrite' => array('slug' => 'portfolio'),
|
||||
));
|
||||
}
|
||||
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'),
|
||||
'title' => __('Slogan du site', 'wp-theme-sen2'),
|
||||
'priority' => 30,
|
||||
));
|
||||
|
||||
$wp_customize->add_setting('wp_theme_sen2_slogan', array(
|
||||
'default' => 'Photographier l\'humain, révéler l\'essentiel.',
|
||||
'default' => 'Moins de bruit, plus d\'âme.',
|
||||
'sanitize_callback' => 'sanitize_text_field',
|
||||
));
|
||||
|
||||
$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',
|
||||
'label' => __('Slogan', 'wp-theme-sen2'),
|
||||
'section' => 'wp_theme_sen2_slogan_section',
|
||||
'type' => 'text',
|
||||
));
|
||||
}
|
||||
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;
|
||||
}
|
||||
?>
|
||||
+29
-13
@@ -8,16 +8,32 @@
|
||||
<?php wp_head(); ?>
|
||||
</head>
|
||||
<body <?php body_class(); ?>>
|
||||
<header class="container">
|
||||
<div class="site-branding">
|
||||
<h1 class="site-title">
|
||||
<a href="<?php echo home_url(); ?>"><?php bloginfo('name'); ?></a>
|
||||
<?php if (get_theme_mod('wp_theme_sen2_show_slogan', true)) : ?>
|
||||
<span class="site-slogan"><?php echo esc_html(get_theme_mod('wp_theme_sen2_slogan', 'Photographier l\'humain, révéler l\'essentiel.')); ?></span>
|
||||
<?php endif; ?>
|
||||
</h1>
|
||||
</div>
|
||||
<nav class="main-navigation">
|
||||
<?php wp_nav_menu(array('theme_location' => 'primary')); ?>
|
||||
</nav>
|
||||
</header>
|
||||
<div class="site-container">
|
||||
<!-- Menu latéral gauche -->
|
||||
<aside class="sidebar">
|
||||
<nav class="sidebar-navigation">
|
||||
<?php
|
||||
wp_nav_menu(array(
|
||||
'theme_location' => 'sidebar',
|
||||
'container' => false,
|
||||
'fallback_cb' => false,
|
||||
'depth' => 1
|
||||
));
|
||||
?>
|
||||
</nav>
|
||||
</aside>
|
||||
|
||||
<!-- Contenu principal -->
|
||||
<div class="main-content">
|
||||
<header class="site-header">
|
||||
<div class="site-branding">
|
||||
<h1 class="site-title">
|
||||
<a href="<?php echo home_url(); ?>"><?php bloginfo('name'); ?></a>
|
||||
</h1>
|
||||
<?php if (get_theme_mod('wp_theme_sen2_show_slogan', true)) : ?>
|
||||
<span class="site-slogan"><?php echo esc_html(get_theme_mod('wp_theme_sen2_slogan', 'Moins de bruit, plus d\'âme.')); ?></span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<main class="site-main">
|
||||
@@ -0,0 +1,18 @@
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
// Gestion du menu latéral en mobile si nécessaire
|
||||
const sidebar = document.querySelector('.sidebar');
|
||||
const mainContent = document.querySelector('.main-content');
|
||||
|
||||
// Ajoute une classe pour le mode mobile
|
||||
function checkScreenSize() {
|
||||
if (window.innerWidth <= 768) {
|
||||
document.body.classList.add('mobile-view');
|
||||
} else {
|
||||
document.body.classList.remove('mobile-view');
|
||||
}
|
||||
}
|
||||
|
||||
// Exécute au chargement et au redimensionnement
|
||||
checkScreenSize();
|
||||
window.addEventListener('resize', checkScreenSize);
|
||||
});
|
||||
@@ -1,58 +1,62 @@
|
||||
/*
|
||||
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.4.0
|
||||
*/
|
||||
|
||||
/* Réinitialisation et base */
|
||||
:root {
|
||||
--primary-color: #3498DB;
|
||||
--secondary-color: #2C3E50;
|
||||
--text-color: #333333;
|
||||
--light-gray: #F9F9F9;
|
||||
--medium-gray: #E0E0E0;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: 'Montserrat', sans-serif;
|
||||
background-color: #F9F9F9;
|
||||
color: #333333;
|
||||
background-color: var(--light-gray);
|
||||
color: var(--text-color);
|
||||
line-height: 1.6;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #555555;
|
||||
text-decoration: none;
|
||||
transition: color 0.3s ease;
|
||||
/* Structure globale */
|
||||
.site-container {
|
||||
display: grid;
|
||||
grid-template-columns: 200px 1fr;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
color: #E1306C;
|
||||
.sidebar {
|
||||
background-color: #FFFFFF;
|
||||
padding: 20px 0;
|
||||
position: fixed;
|
||||
left: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
width: 200px;
|
||||
z-index: 100;
|
||||
border-right: 1px solid var(--medium-gray);
|
||||
}
|
||||
|
||||
.container {
|
||||
max-width: 1200px;
|
||||
margin: 0 auto;
|
||||
padding: 0 20px;
|
||||
.main-content {
|
||||
margin-left: 200px;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
/* Header et slogan */
|
||||
header {
|
||||
background-color: #F9F9F9;
|
||||
padding: 30px 0;
|
||||
border-bottom: 1px solid #EEEEEE;
|
||||
}
|
||||
|
||||
.site-branding {
|
||||
margin-bottom: 20px;
|
||||
.site-header {
|
||||
text-align: center;
|
||||
padding: 20px 0;
|
||||
border-bottom: 1px solid var(--medium-gray);
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
.site-title {
|
||||
margin: 0;
|
||||
font-size: 24px;
|
||||
font-size: 28px;
|
||||
font-weight: 600;
|
||||
color: #333333;
|
||||
line-height: 1.2;
|
||||
color: var(--secondary-color);
|
||||
}
|
||||
|
||||
.site-title a {
|
||||
@@ -62,136 +66,85 @@ header {
|
||||
|
||||
.site-slogan {
|
||||
display: block;
|
||||
font-family: 'Montserrat', sans-serif;
|
||||
font-weight: 300;
|
||||
font-size: 16px;
|
||||
color: #555555;
|
||||
letter-spacing: 0.5px;
|
||||
margin-top: 5px;
|
||||
color: #7F8C8D;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.main-navigation ul {
|
||||
/* Menu latéral */
|
||||
.sidebar-navigation {
|
||||
padding: 0 20px;
|
||||
}
|
||||
|
||||
.sidebar-navigation ul {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
display: flex;
|
||||
gap: 20px;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.main-navigation a {
|
||||
font-weight: 500;
|
||||
color: #333333;
|
||||
.sidebar-navigation li {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.sidebar-navigation a {
|
||||
display: block;
|
||||
color: var(--text-color);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.main-navigation a:hover {
|
||||
color: #E1306C;
|
||||
}
|
||||
|
||||
/* Footer */
|
||||
footer {
|
||||
background-color: #F9F9F9;
|
||||
padding: 20px 0;
|
||||
text-align: center;
|
||||
border-top: 1px solid #EEEEEE;
|
||||
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;
|
||||
padding: 8px 15px;
|
||||
border-radius: 4px;
|
||||
margin: 2em 0;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.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);
|
||||
.sidebar-navigation a:hover,
|
||||
.sidebar-navigation .current-menu-item a {
|
||||
background-color: var(--primary-color);
|
||||
color: white;
|
||||
}
|
||||
|
||||
/* Responsive */
|
||||
@media (max-width: 768px) {
|
||||
.about-content {
|
||||
flex-direction: column;
|
||||
.site-container {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
.about-banner h1 {
|
||||
font-size: 28px;
|
||||
|
||||
.sidebar {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
border-right: none;
|
||||
border-bottom: 1px solid var(--medium-gray);
|
||||
}
|
||||
|
||||
.main-content {
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
.sidebar-navigation ul {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
gap: 20px;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.sidebar-navigation li {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Galerie et contenu */
|
||||
.site-main {
|
||||
padding: 20px 0;
|
||||
}
|
||||
|
||||
.envira-gallery-wrap {
|
||||
margin-left: 0; /* Alignement avec le menu latéral */
|
||||
}
|
||||
|
||||
/* Footer */
|
||||
.site-footer {
|
||||
background-color: var(--light-gray);
|
||||
padding: 30px 0;
|
||||
text-align: center;
|
||||
border-top: 1px solid var(--medium-gray);
|
||||
margin-top: 40px;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user