Ajout logo R, bouton Blog et reorganisation de l'arborescence
- Logo R entoure dans le header - Bouton Blog redirigeant vers blog.rdacet.fr - functions.php decoupe en modules inc/ (setup, helpers, data) - Page Templates deplaces dans templates/ avec filtre de compatibilite - README mis a jour avec la nouvelle structure du theme
This commit is contained in:
1 parent
7f0d3ee895
commit
8bf0c34646
13 files changed
+244
-111
No files matched your search
@@ -13,6 +13,39 @@ Le site présente mon CV, ma lettre de motivation, mes projets et ma veille tech
|
||||
- **Veille technologique** — à compléter
|
||||
- **Contact** — téléphone, email, formulaire WPForms
|
||||
|
||||
## Structure du thème
|
||||
|
||||
```
|
||||
portfolio-rd/
|
||||
├── style.css # Métadonnées du thème + styles (requis racine)
|
||||
├── index.php # Fallback liste d'articles (requis racine)
|
||||
├── functions.php # Charge les modules de /inc
|
||||
├── header.php # En-tête (logo R + menu + bouton Blog)
|
||||
├── footer.php # Pied de page
|
||||
├── front-page.php # Page d'accueil
|
||||
├── page.php # Modèle de page par défaut
|
||||
├── inc/
|
||||
│ ├── setup.php # Supports du thème, menus, enqueue des assets
|
||||
│ ├── helpers.php # Utilitaires + compat des Page Templates déplacés
|
||||
│ └── data.php # Données (compétences, formation, projets…)
|
||||
├── templates/ # Page Templates (Modèles de page WordPress)
|
||||
│ ├── template-cv.php
|
||||
│ ├── template-lettre.php
|
||||
│ ├── template-projets.php
|
||||
│ ├── template-projet-brasserie.php
|
||||
│ ├── template-veille.php
|
||||
│ └── template-contact.php
|
||||
└── assets/
|
||||
├── img/ # Images (dont brasserie/)
|
||||
├── js/main.js # Menu mobile
|
||||
└── pdf/ # CV et lettre de motivation
|
||||
```
|
||||
|
||||
> Les fichiers `style.css`, `index.php`, `functions.php`, `header.php`, `footer.php`,
|
||||
> `front-page.php` et `page.php` doivent rester à la racine (hiérarchie de templates WordPress).
|
||||
> Les Page Templates vivent dans `/templates` (supporté depuis WordPress 4.7) ; un filtre dans
|
||||
> `inc/helpers.php` assure la compatibilité des pages déjà assignées avant le déplacement.
|
||||
|
||||
## Stack
|
||||
|
||||
- WordPress (thème custom, from scratch)
|
||||
|
||||
+10
-109
@@ -1,118 +1,19 @@
|
||||
<?php
|
||||
/**
|
||||
* Portfolio Romain Dacet — functions.php
|
||||
*
|
||||
* Point d'entrée du thème : charge les modules situés dans /inc.
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) { exit; }
|
||||
|
||||
/* ------------------------------------------------------------
|
||||
* Setup
|
||||
* ------------------------------------------------------------ */
|
||||
function prd_setup() {
|
||||
add_theme_support( 'title-tag' );
|
||||
add_theme_support( 'post-thumbnails' );
|
||||
add_theme_support( 'html5', array( 'search-form', 'gallery', 'caption', 'style', 'script' ) );
|
||||
$prd_includes = array(
|
||||
'/inc/setup.php', // Configuration du thème + assets
|
||||
'/inc/helpers.php', // Fonctions utilitaires + compat templates
|
||||
'/inc/data.php', // Données (compétences, formation, projets…)
|
||||
);
|
||||
|
||||
register_nav_menus( array(
|
||||
'primary' => __( 'Menu principal', 'portfolio-rd' ),
|
||||
) );
|
||||
}
|
||||
add_action( 'after_setup_theme', 'prd_setup' );
|
||||
|
||||
/* ------------------------------------------------------------
|
||||
* Assets
|
||||
* ------------------------------------------------------------ */
|
||||
function prd_enqueue_assets() {
|
||||
wp_enqueue_style(
|
||||
'prd-fonts',
|
||||
'https://fonts.googleapis.com/css2?family=Fraunces:ital,wght@0,400;0,500;0,600;1,400;1,500&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap',
|
||||
array(),
|
||||
null
|
||||
);
|
||||
wp_enqueue_style( 'prd-main', get_stylesheet_uri(), array( 'prd-fonts' ), wp_get_theme()->get( 'Version' ) );
|
||||
wp_enqueue_script( 'prd-main', get_template_directory_uri() . '/assets/js/main.js', array(), wp_get_theme()->get( 'Version' ), true );
|
||||
}
|
||||
add_action( 'wp_enqueue_scripts', 'prd_enqueue_assets' );
|
||||
|
||||
/* ------------------------------------------------------------
|
||||
* Helpers
|
||||
* ------------------------------------------------------------ */
|
||||
function prd_img( $name ) { return esc_url( get_template_directory_uri() . '/assets/img/' . $name ); }
|
||||
function prd_pdf( $name ) { return esc_url( get_template_directory_uri() . '/assets/pdf/' . $name ); }
|
||||
|
||||
/**
|
||||
* URL d'une page à partir de son slug. Si la page n'existe pas encore dans
|
||||
* l'admin WP, on retombe sur /?page_name=slug qui redirigera dès création.
|
||||
*/
|
||||
function prd_page_url( $slug ) {
|
||||
$page = get_page_by_path( $slug );
|
||||
if ( $page ) {
|
||||
return get_permalink( $page );
|
||||
}
|
||||
return esc_url( home_url( '/?page_name=' . $slug ) );
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------
|
||||
* Menu fallback
|
||||
* ------------------------------------------------------------ */
|
||||
function prd_fallback_menu() {
|
||||
echo '<ul>';
|
||||
echo '<li><a href="' . esc_url( home_url( '/' ) ) . '">Accueil</a></li>';
|
||||
echo '<li><a href="' . prd_page_url( 'cv' ) . '">CV</a></li>';
|
||||
echo '<li><a href="' . prd_page_url( 'lettre-motivation' ). '">Lettre</a></li>';
|
||||
echo '<li><a href="' . prd_page_url( 'projets' ) . '">Projets</a></li>';
|
||||
echo '<li><a href="' . prd_page_url( 'veille' ) . '">Veille</a></li>';
|
||||
echo '<li><a href="' . prd_page_url( 'contact' ) . '">Contact</a></li>';
|
||||
echo '</ul>';
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------
|
||||
* Données : compétences, formation, projets
|
||||
* ------------------------------------------------------------ */
|
||||
function prd_get_skills() {
|
||||
return array(
|
||||
array( 'name' => 'Linux', 'desc' => 'Administration système, gestion des utilisateurs et des services.' ),
|
||||
array( 'name' => 'Serveurs Windows & Linux', 'desc' => 'Installation, configuration et maintenance de serveurs.' ),
|
||||
array( 'name' => 'Configuration réseau', 'desc' => 'Routage, firewall, DNS, mise en place d\'infrastructures.' ),
|
||||
array( 'name' => 'Scripts', 'desc' => 'Automatisation en Bash et PHP CLI.' ),
|
||||
array( 'name' => 'MySQL', 'desc' => 'Conception, requêtes et gestion de bases de données.' ),
|
||||
array( 'name' => 'HTML / CSS', 'desc' => 'Intégration web et mise en forme de sites statiques.' ),
|
||||
);
|
||||
}
|
||||
|
||||
function prd_get_formation() {
|
||||
return array(
|
||||
array( 'date' => '2025 – 2026', 'title' => 'BTS SIO — 1ʳᵉ année', 'desc' => 'Services Informatiques aux Organisations, Lycée Guy Mollet, Arras.' ),
|
||||
array( 'date' => 'Juin 2025', 'title' => 'Permis de conduire', 'desc' => 'Obtention du permis B.' ),
|
||||
array( 'date' => '2024 – 2025', 'title' => 'BTS CIEL — 1ʳᵉ année', 'desc' => 'Cybersécurité, Informatique, Électronique, Lycée Gustave Eiffel, Armentières.' ),
|
||||
array( 'date' => '2024', 'title' => 'Baccalauréat Système Numérique — opt. B', 'desc' => 'Audiovisuel, réseau et équipements domestiques — mention AB. Lycée Savary-Ferry, Arras.' ),
|
||||
array( 'date' => '2021 – 2022', 'title' => 'Seconde professionnelle', 'desc' => 'Transition numérique et énergétique, Lycée Savary-Ferry, Arras.' ),
|
||||
);
|
||||
}
|
||||
|
||||
function prd_get_experiences() {
|
||||
return array(
|
||||
array( 'date' => '26 mai – 4 juillet 2025', 'title' => 'Conseil départemental du Pas-de-Calais', 'tagline' => 'Appel de clients, installation de matériel (service informatique).' ),
|
||||
array( 'date' => '29 janv. – 23 févr. 2024', 'title' => 'Préfecture d\'Arras', 'tagline' => 'Installation Windows, mise en place d\'un réseau pour une salle de conférence.' ),
|
||||
array( 'date' => '25 sept. – 22 oct. 2023', 'title' => 'Pro&Cie', 'tagline' => 'Réparation et dépannage de machines électroménagères.' ),
|
||||
array( 'date' => '8 mai – 2 juin 2023', 'title' => 'Axecibles', 'tagline' => 'Installation Windows / Linux et résolution de problèmes internes.' ),
|
||||
array( 'date' => '21 nov. – 17 déc. 2022', 'title' => 'Itech Informatique et Technologies', 'tagline' => 'Configuration d\'un Qwartz avec l\'employeur.' ),
|
||||
array( 'date' => '6 juin – 2 juillet 2022', 'title' => 'Amipro Boréal Parc', 'tagline' => 'Réparation de PC et installation Windows.' ),
|
||||
array( 'date' => '6 – 17 décembre 2021', 'title' => 'Inov-Agency', 'tagline' => 'Première expérience — programmation HTML / CSS.' ),
|
||||
);
|
||||
}
|
||||
|
||||
function prd_get_projects() {
|
||||
return array(
|
||||
array(
|
||||
'slug' => 'brasserie',
|
||||
'title' => 'Brasserie Terroir & Savoirs',
|
||||
'tagline' => 'Site vitrine WordPress sur mesure pour une brasserie artisanale.',
|
||||
'year' => '2026',
|
||||
'context' => 'BTS SIO — projet personnel',
|
||||
'tags' => array( 'WordPress', 'PHP', 'HTML/CSS', 'JavaScript', 'InfinityFree' ),
|
||||
'live_url' => 'https://rdacetbrasserie.free.nf',
|
||||
'url' => 'projet-brasserie',
|
||||
),
|
||||
);
|
||||
foreach ( $prd_includes as $prd_file ) {
|
||||
require_once get_template_directory() . $prd_file;
|
||||
}
|
||||
unset( $prd_file );
|
||||
+9
-2
@@ -13,14 +13,14 @@
|
||||
<header class="site-header">
|
||||
<div class="container">
|
||||
<a href="<?php echo esc_url( home_url( '/' ) ); ?>" class="site-logo">
|
||||
<span class="logo-mark" aria-hidden="true">R</span>
|
||||
<span class="site-title">
|
||||
Romain Dacet
|
||||
<small>Portfolio</small>
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<button class="nav-toggle" aria-label="Ouvrir le menu" aria-expanded="false">☰</button>
|
||||
|
||||
<div class="header-actions">
|
||||
<nav class="main-nav" aria-label="Navigation principale">
|
||||
<?php
|
||||
if ( has_nav_menu( 'primary' ) ) {
|
||||
@@ -35,6 +35,13 @@
|
||||
}
|
||||
?>
|
||||
</nav>
|
||||
|
||||
<a class="btn btn--blog" href="https://blog.rdacet.fr" target="_blank" rel="noopener">
|
||||
Blog <span class="arrow-i" aria-hidden="true">↗</span>
|
||||
</a>
|
||||
|
||||
<button class="nav-toggle" aria-label="Ouvrir le menu" aria-expanded="false">☰</button>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
/**
|
||||
* Données du portfolio : compétences, formation, expériences, projets.
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) { exit; }
|
||||
|
||||
function prd_get_skills() {
|
||||
return array(
|
||||
array( 'name' => 'Linux', 'desc' => 'Administration système, gestion des utilisateurs et des services.' ),
|
||||
array( 'name' => 'Serveurs Windows & Linux', 'desc' => 'Installation, configuration et maintenance de serveurs.' ),
|
||||
array( 'name' => 'Configuration réseau', 'desc' => 'Routage, firewall, DNS, mise en place d\'infrastructures.' ),
|
||||
array( 'name' => 'Scripts', 'desc' => 'Automatisation en Bash et PHP CLI.' ),
|
||||
array( 'name' => 'MySQL', 'desc' => 'Conception, requêtes et gestion de bases de données.' ),
|
||||
array( 'name' => 'HTML / CSS', 'desc' => 'Intégration web et mise en forme de sites statiques.' ),
|
||||
);
|
||||
}
|
||||
|
||||
function prd_get_formation() {
|
||||
return array(
|
||||
array( 'date' => '2025 – 2026', 'title' => 'BTS SIO — 1ʳᵉ année', 'desc' => 'Services Informatiques aux Organisations, Lycée Guy Mollet, Arras.' ),
|
||||
array( 'date' => 'Juin 2025', 'title' => 'Permis de conduire', 'desc' => 'Obtention du permis B.' ),
|
||||
array( 'date' => '2024 – 2025', 'title' => 'BTS CIEL — 1ʳᵉ année', 'desc' => 'Cybersécurité, Informatique, Électronique, Lycée Gustave Eiffel, Armentières.' ),
|
||||
array( 'date' => '2024', 'title' => 'Baccalauréat Système Numérique — opt. B', 'desc' => 'Audiovisuel, réseau et équipements domestiques — mention AB. Lycée Savary-Ferry, Arras.' ),
|
||||
array( 'date' => '2021 – 2022', 'title' => 'Seconde professionnelle', 'desc' => 'Transition numérique et énergétique, Lycée Savary-Ferry, Arras.' ),
|
||||
);
|
||||
}
|
||||
|
||||
function prd_get_experiences() {
|
||||
return array(
|
||||
array( 'date' => '26 mai – 4 juillet 2025', 'title' => 'Conseil départemental du Pas-de-Calais', 'tagline' => 'Appel de clients, installation de matériel (service informatique).' ),
|
||||
array( 'date' => '29 janv. – 23 févr. 2024', 'title' => 'Préfecture d\'Arras', 'tagline' => 'Installation Windows, mise en place d\'un réseau pour une salle de conférence.' ),
|
||||
array( 'date' => '25 sept. – 22 oct. 2023', 'title' => 'Pro&Cie', 'tagline' => 'Réparation et dépannage de machines électroménagères.' ),
|
||||
array( 'date' => '8 mai – 2 juin 2023', 'title' => 'Axecibles', 'tagline' => 'Installation Windows / Linux et résolution de problèmes internes.' ),
|
||||
array( 'date' => '21 nov. – 17 déc. 2022', 'title' => 'Itech Informatique et Technologies', 'tagline' => 'Configuration d\'un Qwartz avec l\'employeur.' ),
|
||||
array( 'date' => '6 juin – 2 juillet 2022', 'title' => 'Amipro Boréal Parc', 'tagline' => 'Réparation de PC et installation Windows.' ),
|
||||
array( 'date' => '6 – 17 décembre 2021', 'title' => 'Inov-Agency', 'tagline' => 'Première expérience — programmation HTML / CSS.' ),
|
||||
);
|
||||
}
|
||||
|
||||
function prd_get_projects() {
|
||||
return array(
|
||||
array(
|
||||
'slug' => 'brasserie',
|
||||
'title' => 'Brasserie Terroir & Savoirs',
|
||||
'tagline' => 'Site vitrine WordPress sur mesure pour une brasserie artisanale.',
|
||||
'year' => '2026',
|
||||
'context' => 'BTS SIO — projet personnel',
|
||||
'tags' => array( 'WordPress', 'PHP', 'HTML/CSS', 'JavaScript', 'InfinityFree' ),
|
||||
'live_url' => 'https://rdacetbrasserie.free.nf',
|
||||
'url' => 'projet-brasserie',
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
/**
|
||||
* Fonctions utilitaires (URLs assets, pages, menu de secours)
|
||||
* et compatibilité des Page Templates déplacés dans /templates.
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) { exit; }
|
||||
|
||||
/* ------------------------------------------------------------
|
||||
* Helpers
|
||||
* ------------------------------------------------------------ */
|
||||
function prd_img( $name ) { return esc_url( get_template_directory_uri() . '/assets/img/' . $name ); }
|
||||
function prd_pdf( $name ) { return esc_url( get_template_directory_uri() . '/assets/pdf/' . $name ); }
|
||||
|
||||
/**
|
||||
* URL d'une page à partir de son slug. Si la page n'existe pas encore dans
|
||||
* l'admin WP, on retombe sur /?page_name=slug qui redirigera dès création.
|
||||
*/
|
||||
function prd_page_url( $slug ) {
|
||||
$page = get_page_by_path( $slug );
|
||||
if ( $page ) {
|
||||
return get_permalink( $page );
|
||||
}
|
||||
return esc_url( home_url( '/?page_name=' . $slug ) );
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------
|
||||
* Menu fallback
|
||||
* ------------------------------------------------------------ */
|
||||
function prd_fallback_menu() {
|
||||
echo '<ul>';
|
||||
echo '<li><a href="' . esc_url( home_url( '/' ) ) . '">Accueil</a></li>';
|
||||
echo '<li><a href="' . prd_page_url( 'cv' ) . '">CV</a></li>';
|
||||
echo '<li><a href="' . prd_page_url( 'lettre-motivation' ). '">Lettre</a></li>';
|
||||
echo '<li><a href="' . prd_page_url( 'projets' ) . '">Projets</a></li>';
|
||||
echo '<li><a href="' . prd_page_url( 'veille' ) . '">Veille</a></li>';
|
||||
echo '<li><a href="' . prd_page_url( 'contact' ) . '">Contact</a></li>';
|
||||
echo '</ul>';
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------
|
||||
* Compatibilité Page Templates déplacés vers /templates
|
||||
*
|
||||
* Les pages déjà assignées en base stockent l'ancien chemin
|
||||
* (ex. « template-cv.php »). Après déplacement dans /templates,
|
||||
* on remappe ce chemin pour ne pas perdre l'association de page.
|
||||
* ------------------------------------------------------------ */
|
||||
function prd_remap_legacy_page_template( $template ) {
|
||||
if ( $template && file_exists( $template ) ) {
|
||||
return $template;
|
||||
}
|
||||
|
||||
$slug = get_page_template_slug( get_queried_object_id() );
|
||||
if ( $slug && 'default' !== $slug && 0 === validate_file( $slug ) ) {
|
||||
$candidate = locate_template( 'templates/' . basename( $slug ) );
|
||||
if ( $candidate ) {
|
||||
return $candidate;
|
||||
}
|
||||
}
|
||||
|
||||
return $template;
|
||||
}
|
||||
add_filter( 'page_template', 'prd_remap_legacy_page_template' );
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/**
|
||||
* Configuration du thème et chargement des assets.
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) { exit; }
|
||||
|
||||
/* ------------------------------------------------------------
|
||||
* Setup
|
||||
* ------------------------------------------------------------ */
|
||||
function prd_setup() {
|
||||
add_theme_support( 'title-tag' );
|
||||
add_theme_support( 'post-thumbnails' );
|
||||
add_theme_support( 'html5', array( 'search-form', 'gallery', 'caption', 'style', 'script' ) );
|
||||
|
||||
register_nav_menus( array(
|
||||
'primary' => __( 'Menu principal', 'portfolio-rd' ),
|
||||
) );
|
||||
}
|
||||
add_action( 'after_setup_theme', 'prd_setup' );
|
||||
|
||||
/* ------------------------------------------------------------
|
||||
* Assets
|
||||
* ------------------------------------------------------------ */
|
||||
function prd_enqueue_assets() {
|
||||
wp_enqueue_style(
|
||||
'prd-fonts',
|
||||
'https://fonts.googleapis.com/css2?family=Fraunces:ital,wght@0,400;0,500;0,600;1,400;1,500&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap',
|
||||
array(),
|
||||
null
|
||||
);
|
||||
wp_enqueue_style( 'prd-main', get_stylesheet_uri(), array( 'prd-fonts' ), wp_get_theme()->get( 'Version' ) );
|
||||
wp_enqueue_script( 'prd-main', get_template_directory_uri() . '/assets/js/main.js', array(), wp_get_theme()->get( 'Version' ), true );
|
||||
}
|
||||
add_action( 'wp_enqueue_scripts', 'prd_enqueue_assets' );
|
||||
@@ -139,6 +139,32 @@ em { font-family: var(--font-serif); font-style: italic; }
|
||||
padding: 1.1rem 1.75rem;
|
||||
gap: 1rem;
|
||||
}
|
||||
.site-logo {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: .7rem;
|
||||
}
|
||||
.logo-mark {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 42px;
|
||||
height: 42px;
|
||||
flex-shrink: 0;
|
||||
border: 1.5px solid var(--ink);
|
||||
border-radius: 50%;
|
||||
font-family: var(--font-serif);
|
||||
font-size: 1.25rem;
|
||||
font-weight: 600;
|
||||
line-height: 1;
|
||||
color: var(--ink);
|
||||
transition: background .2s, color .2s, transform .2s;
|
||||
}
|
||||
.site-logo:hover .logo-mark {
|
||||
background: var(--ink);
|
||||
color: var(--bg);
|
||||
transform: rotate(-6deg);
|
||||
}
|
||||
.site-logo .site-title {
|
||||
font-family: var(--font-serif);
|
||||
font-size: 1.15rem;
|
||||
@@ -157,6 +183,18 @@ em { font-family: var(--font-serif); font-style: italic; }
|
||||
font-weight: 500;
|
||||
margin-top: .3rem;
|
||||
}
|
||||
.header-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 1.75rem;
|
||||
}
|
||||
.btn--blog {
|
||||
padding: .55rem 1.15rem;
|
||||
font-size: .85rem;
|
||||
}
|
||||
.btn--blog .arrow-i { font-size: .95rem; }
|
||||
.btn--blog:hover .arrow-i { transform: translate(2px, -2px); }
|
||||
|
||||
.main-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 2.25rem; }
|
||||
.main-nav a {
|
||||
color: var(--ink-soft);
|
||||
@@ -669,6 +707,8 @@ section.alt { background: var(--bg-alt); }
|
||||
|
||||
@media (max-width: 720px) {
|
||||
.nav-toggle { display: block; }
|
||||
.header-actions { gap: .9rem; }
|
||||
.logo-mark { width: 38px; height: 38px; font-size: 1.1rem; }
|
||||
.main-nav {
|
||||
position: absolute; top: 100%; left: 0; right: 0;
|
||||
background: var(--bg);
|
||||
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Reference in new issue
Block a user