Compare commits
1 Commits
87ebec0e5f
..
v1.3.0
| Author | SHA1 | Date | |
|---|---|---|---|
| 68f13dce91 |
+13
-64
@@ -1,15 +1,20 @@
|
|||||||
<?php
|
<?php
|
||||||
// Enregistrement des menus
|
// Configuration de base
|
||||||
function wp_theme_sen2_setup() {
|
function wp_theme_sen2_setup() {
|
||||||
|
// Enregistrement des menus
|
||||||
register_nav_menus(array(
|
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('post-thumbnails');
|
||||||
add_theme_support('title-tag');
|
add_theme_support('title-tag');
|
||||||
|
add_theme_support('automatic-feed-links');
|
||||||
}
|
}
|
||||||
add_action('after_setup_theme', 'wp_theme_sen2_setup');
|
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() {
|
function wp_theme_sen2_scripts() {
|
||||||
wp_enqueue_style('wp-theme-sen2-style', get_stylesheet_uri());
|
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-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
|
// Custom Post Type pour Portfolio
|
||||||
function wp_theme_sen2_custom_post_type() {
|
function wp_theme_sen2_custom_post_type() {
|
||||||
register_post_type('portfolio',
|
register_post_type('portfolio', array(
|
||||||
array(
|
|
||||||
'labels' => array(
|
'labels' => array(
|
||||||
'name' => 'Portfolio',
|
'name' => __('Portfolio', 'wp-theme-sen2'),
|
||||||
'singular_name' => 'Projet'
|
'singular_name' => __('Projet', 'wp-theme-sen2')
|
||||||
),
|
),
|
||||||
'public' => true,
|
'public' => true,
|
||||||
'has_archive' => true,
|
'has_archive' => true,
|
||||||
'supports' => array('title', 'editor', 'thumbnail'),
|
'supports' => array('title', 'editor', 'thumbnail'),
|
||||||
)
|
));
|
||||||
);
|
|
||||||
}
|
}
|
||||||
add_action('init', 'wp_theme_sen2_custom_post_type');
|
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) {
|
function wp_theme_sen2_customize_register($wp_customize) {
|
||||||
$wp_customize->add_section('wp_theme_sen2_slogan_section', array(
|
$wp_customize->add_section('wp_theme_sen2_slogan_section', array(
|
||||||
'title' => __('Slogan du site', 'wp-theme-sen2'),
|
'title' => __('Slogan du site', 'wp-theme-sen2'),
|
||||||
@@ -48,62 +51,8 @@ function wp_theme_sen2_customize_register($wp_customize) {
|
|||||||
$wp_customize->add_control('wp_theme_sen2_slogan_control', array(
|
$wp_customize->add_control('wp_theme_sen2_slogan_control', array(
|
||||||
'label' => __('Slogan', 'wp-theme-sen2'),
|
'label' => __('Slogan', 'wp-theme-sen2'),
|
||||||
'section' => 'wp_theme_sen2_slogan_section',
|
'section' => 'wp_theme_sen2_slogan_section',
|
||||||
'settings' => 'wp_theme_sen2_slogan',
|
|
||||||
'type' => 'text',
|
'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');
|
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;
|
|
||||||
}
|
|
||||||
function wp_theme_sen2_setup() {
|
|
||||||
register_nav_menus(array(
|
|
||||||
'primary' => 'Menu Principal',
|
|
||||||
'secondary' => 'Menu Secondaire' // Nouveau menu
|
|
||||||
));
|
|
||||||
add_theme_support('post-thumbnails');
|
|
||||||
add_theme_support('title-tag');
|
|
||||||
}
|
|
||||||
?>
|
?>
|
||||||
+9
-8
@@ -9,19 +9,25 @@
|
|||||||
</head>
|
</head>
|
||||||
<body <?php body_class(); ?>>
|
<body <?php body_class(); ?>>
|
||||||
<header class="container">
|
<header class="container">
|
||||||
<div class="site-header">
|
<!-- 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 -->
|
<!-- Menu secondaire à gauche -->
|
||||||
<nav class="secondary-navigation">
|
<nav class="secondary-navigation">
|
||||||
<?php
|
<?php
|
||||||
wp_nav_menu(array(
|
wp_nav_menu(array(
|
||||||
'theme_location' => 'secondary',
|
'theme_location' => 'secondary',
|
||||||
'fallback_cb' => false,
|
'fallback_cb' => false,
|
||||||
'depth' => 1
|
'depth' => 1,
|
||||||
|
'container' => false
|
||||||
));
|
));
|
||||||
?>
|
?>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<!-- Logo au centre -->
|
<!-- Logo centré -->
|
||||||
<div class="site-branding">
|
<div class="site-branding">
|
||||||
<h1 class="site-title">
|
<h1 class="site-title">
|
||||||
<a href="<?php echo home_url(); ?>"><?php bloginfo('name'); ?></a>
|
<a href="<?php echo home_url(); ?>"><?php bloginfo('name'); ?></a>
|
||||||
@@ -30,10 +36,5 @@
|
|||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</h1>
|
</h1>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Menu principal à droite -->
|
|
||||||
<nav class="main-navigation">
|
|
||||||
<?php wp_nav_menu(array('theme_location' => 'primary')); ?>
|
|
||||||
</nav>
|
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
@@ -1,12 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Theme Name: WP Theme SEN2
|
Theme Name: WP Theme SEN2
|
||||||
Theme URI: https://ton-site.com/wp-theme-sen2
|
Version: 1.3.0
|
||||||
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.1.0 <!-- Ajout d'un menu à doite -->
|
|
||||||
License: GNU General Public License v2 or later
|
|
||||||
Text Domain: wp-theme-sen2
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Réinitialisation et base */
|
/* Réinitialisation et base */
|
||||||
@@ -17,17 +11,6 @@ body {
|
|||||||
line-height: 1.6;
|
line-height: 1.6;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
font-size: 16px;
|
|
||||||
}
|
|
||||||
|
|
||||||
a {
|
|
||||||
color: #555555;
|
|
||||||
text-decoration: none;
|
|
||||||
transition: color 0.3s ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
a:hover {
|
|
||||||
color: #E1306C;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.container {
|
.container {
|
||||||
@@ -36,46 +19,25 @@ a:hover {
|
|||||||
padding: 0 20px;
|
padding: 0 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Header et slogan */
|
/* Header et navigation */
|
||||||
header {
|
header {
|
||||||
background-color: #F9F9F9;
|
padding: 20px 0;
|
||||||
padding: 30px 0;
|
|
||||||
border-bottom: 1px solid #EEEEEE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.site-branding {
|
.main-navigation {
|
||||||
|
text-align: center;
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
}
|
border-bottom: 1px solid #EEEEEE;
|
||||||
|
padding-bottom: 10px;
|
||||||
.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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.main-navigation ul {
|
.main-navigation ul {
|
||||||
list-style: none;
|
list-style: none;
|
||||||
padding: 0;
|
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 20px;
|
justify-content: center;
|
||||||
|
gap: 30px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.main-navigation a {
|
.main-navigation a {
|
||||||
@@ -87,81 +49,89 @@ header {
|
|||||||
.main-navigation a:hover {
|
.main-navigation a:hover {
|
||||||
color: #E1306C;
|
color: #E1306C;
|
||||||
}
|
}
|
||||||
/* Header et navigation */
|
|
||||||
.site-header {
|
.header-content {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
align-items: center;
|
||||||
width: 100%;
|
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
.site-branding {
|
|
||||||
position: absolute;
|
|
||||||
left: 50%;
|
|
||||||
transform: translateX(-50%);
|
|
||||||
text-align: center;
|
|
||||||
margin: 0 auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.main-navigation {
|
|
||||||
margin-left: auto; /* Pousse le menu principal à droite */
|
|
||||||
}
|
|
||||||
|
|
||||||
.secondary-navigation {
|
.secondary-navigation {
|
||||||
margin-right: auto; /* Pousse le menu secondaire à gauche */
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
top: 50%;
|
||||||
|
transform: translateY(-50%);
|
||||||
|
z-index: 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Style des menus */
|
.site-branding {
|
||||||
.secondary-navigation ul,
|
width: 100%;
|
||||||
.main-navigation ul {
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.site-slogan {
|
||||||
|
display: block;
|
||||||
|
font-weight: 300;
|
||||||
|
font-size: 16px;
|
||||||
|
color: #555555;
|
||||||
|
margin-top: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.secondary-navigation ul {
|
||||||
list-style: none;
|
list-style: none;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 20px;
|
flex-direction: column;
|
||||||
|
gap: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.secondary-navigation a,
|
.secondary-navigation li {
|
||||||
.main-navigation a {
|
writing-mode: vertical-rl;
|
||||||
font-family: 'Montserrat', sans-serif;
|
text-orientation: mixed;
|
||||||
font-weight: 400;
|
}
|
||||||
|
|
||||||
|
.secondary-navigation a {
|
||||||
|
font-size: 14px;
|
||||||
color: #555555;
|
color: #555555;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
transition: color 0.3s ease;
|
transition: color 0.3s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
.secondary-navigation a:hover,
|
.secondary-navigation a:hover {
|
||||||
.main-navigation a:hover {
|
|
||||||
color: #E1306C;
|
color: #E1306C;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Responsive */
|
/* Responsive */
|
||||||
@media (max-width: 768px) {
|
@media (max-width: 768px) {
|
||||||
.site-header {
|
.header-content {
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 15px;
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
|
|
||||||
.site-branding {
|
|
||||||
position: static;
|
|
||||||
transform: none;
|
|
||||||
order: 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.secondary-navigation {
|
.secondary-navigation {
|
||||||
order: 2;
|
position: static;
|
||||||
margin-right: 0;
|
transform: none;
|
||||||
|
writing-mode: horizontal-tb;
|
||||||
|
margin-bottom: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.main-navigation {
|
.secondary-navigation ul {
|
||||||
order: 3;
|
flex-direction: row;
|
||||||
margin-left: 0;
|
justify-content: center;
|
||||||
|
gap: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.secondary-navigation li {
|
||||||
|
writing-mode: horizontal-tb;
|
||||||
|
text-orientation: initial;
|
||||||
|
}
|
||||||
|
|
||||||
|
.main-navigation ul {
|
||||||
|
flex-wrap: wrap;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Footer */
|
/* Footer et autres styles (à conserver) */
|
||||||
footer {
|
footer {
|
||||||
background-color: #F9F9F9;
|
background-color: #F9F9F9;
|
||||||
padding: 20px 0;
|
padding: 20px 0;
|
||||||
@@ -170,115 +140,4 @@ footer {
|
|||||||
margin-top: 40px;
|
margin-top: 40px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.social-icons {
|
/* Le reste de ton CSS existant... */
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Responsive */
|
|
||||||
@media (max-width: 768px) {
|
|
||||||
.site-header {
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 15px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.secondary-navigation {
|
|
||||||
order: 3;
|
|
||||||
width: 100%;
|
|
||||||
justify-content: center;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user