From fc84f5aa27db40b857e9dc77f0b4997cded763c1 Mon Sep 17 00:00:00 2001 From: Nicolas Houzeau Date: Wed, 8 Oct 2025 13:13:39 +0000 Subject: [PATCH] =?UTF-8?q?Version=201.0.0=20-=20Initialisation=20du=20th?= =?UTF-8?q?=C3=A8me=20WP=20Theme=20SEN2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- functions.php | 74 +++++++++++++++++++++++---------------------------- header.php | 4 +-- style.css | 8 +++--- 3 files changed, 40 insertions(+), 46 deletions(-) diff --git a/functions.php b/functions.php index a66506d..c550745 100644 --- a/functions.php +++ b/functions.php @@ -1,24 +1,24 @@ 'Menu Principal', )); add_theme_support('post-thumbnails'); add_theme_support('title-tag'); } -add_action('after_setup_theme', 'portfolio_photo_setup'); +add_action('after_setup_theme', 'wp_theme_sen2_setup'); // Ajout des feuilles de style et scripts -function portfolio_photo_scripts() { - wp_enqueue_style('wordpress-style', get_stylesheet_uri()); - wp_enqueue_style('wordpress-google-fonts', 'https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600&display=swap'); - wp_enqueue_style('wordpress-font-awesome', 'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css'); +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'); } -add_action('wp_enqueue_scripts', 'portfolio_photo_scripts'); +add_action('wp_enqueue_scripts', 'wp_theme_sen2_scripts'); // Custom Post Type pour Portfolio -function portfolio_photo_custom_post_type() { +function wp_theme_sen2_custom_post_type() { register_post_type('portfolio', array( 'labels' => array( @@ -31,62 +31,56 @@ function portfolio_photo_custom_post_type() { ) ); } -add_action('init', 'portfolio_photo_custom_post_type'); +add_action('init', 'wp_theme_sen2_custom_post_type'); // Ajout d'une section "Slogan" dans le Customizer -function portfolio_photo_customize_register($wp_customize) { - // Section pour le slogan - $wp_customize->add_section('portfolio_photo_slogan_section', array( - 'title' => __('Slogan du site', 'wordpress'), +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'), 'priority' => 30, )); - // Setting pour le slogan - $wp_customize->add_setting('portfolio_photo_slogan', array( + $wp_customize->add_setting('wp_theme_sen2_slogan', array( 'default' => 'Photographier l\'humain, révéler l\'essentiel.', 'sanitize_callback' => 'sanitize_text_field', )); - // Contrôle pour éditer le slogan - $wp_customize->add_control('portfolio_photo_slogan_control', array( - 'label' => __('Slogan', 'wordpress'), - 'section' => 'portfolio_photo_slogan_section', - 'settings' => 'portfolio_photo_slogan', + $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', )); - // Option pour afficher/masquer le slogan - $wp_customize->add_setting('portfolio_photo_show_slogan', array( + $wp_customize->add_setting('wp_theme_sen2_show_slogan', array( 'default' => true, - 'sanitize_callback' => 'portfolio_photo_sanitize_checkbox', + 'sanitize_callback' => 'wp_theme_sen2_sanitize_checkbox', )); - $wp_customize->add_control('portfolio_photo_show_slogan_control', array( - 'label' => __('Afficher le slogan', 'wordpress'), - 'section' => 'portfolio_photo_slogan_section', - 'settings' => 'portfolio_photo_show_slogan', + $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', 'portfolio_photo_customize_register'); +add_action('customize_register', 'wp_theme_sen2_customize_register'); -// Fonction pour sanitizer le checkbox -function portfolio_photo_sanitize_checkbox($checked) { +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', 'portfolio_photo_check_for_updates'); -function portfolio_photo_check_for_updates($transient) { +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('wordpress'); + $theme_data = wp_get_theme('wp-theme-sen2'); $current_version = $theme_data->get('Version'); - // Remplace par l'URL de ton dépôt Gitea (raw) - $remote_style_css = 'http://gitea.sen2.lab/admnh/wordpress/raw/branch/main/style.css'; + $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, // Désactive la vérification SSL si ton certificat est auto-signé + 'sslverify' => false, )); if (!is_wp_error($remote_data) && $remote_data['response']['code'] === 200) { @@ -94,11 +88,11 @@ function portfolio_photo_check_for_updates($transient) { $remote_version = $matches[1] ?? null; if ($remote_version && version_compare($current_version, $remote_version, '<')) { - $transient->response['wordpress'] = array( - 'theme' => 'wordpress', + $transient->response['wp-theme-sen2'] = array( + 'theme' => 'wp-theme-sen2', 'new_version' => $remote_version, - 'url' => 'http://gitea.sen2.lab/admnh/wordpress', - 'package' => 'http://gitea.sen2.lab/admnh/wordpress/archive/main.zip', + 'url' => 'http://gitea.sen2.lab/admnh/wp-theme-sen2', + 'package' => 'http://gitea.sen2.lab/admnh/wp-theme-sen2/archive/main.zip', ); } } diff --git a/header.php b/header.php index 392307e..13d6c24 100644 --- a/header.php +++ b/header.php @@ -12,8 +12,8 @@

- - + +

diff --git a/style.css b/style.css index c77c16a..3d904c7 100644 --- a/style.css +++ b/style.css @@ -1,12 +1,12 @@ /* -Theme Name: Portfolio Photo Blanc Cassé -Theme URI: https://ton-site.com/portfolio-photo +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.1.0 +Version: 1.0.0 License: GNU General Public License v2 or later -Text Domain: portfolio-photo +Text Domain: wp-theme-sen2 */ /* Réinitialisation et base */