From a4ad086903bc6d03377e3c70740df65d7b266b3a Mon Sep 17 00:00:00 2001 From: philippelin Date: Mon, 12 Jun 2023 16:46:32 +0200 Subject: [PATCH] tableau et champs personnalises --- functions.php | 32 ++++++++++ package.json | 2 +- resources/views/index.blade.php | 63 ++++++++++++++++--- .../views/partials/content-single.blade.php | 49 +++++++++++++++ yarn.lock | 13 ++-- 5 files changed, 144 insertions(+), 15 deletions(-) diff --git a/functions.php b/functions.php index 9b1b0c0..f0e2cf0 100644 --- a/functions.php +++ b/functions.php @@ -63,3 +63,35 @@ collect(['setup', 'filters']) ); } }); + +//ajout des champs personnalisés Minutage et Images; pour les afficher rdv dans le fichier content-single +function ajout_champs() { + add_post_meta(get_the_ID(), 'Index', true); + add_post_meta(get_the_ID(), 'Minutage', true); + add_post_meta(get_the_ID(), 'Images', true); + add_post_meta(get_the_ID(), 'BandeSon', true); + add_post_meta(get_the_ID(), 'Ecrits', true); + add_post_meta(get_the_ID(), 'VoixOffIn', true); + add_post_meta(get_the_ID(), 'isMainPart', true); + add_post_meta(get_the_ID(), 'isSubPart', true); + + } + add_action('init', 'ajout_champs'); + + + +/* +function supprimer_tous_les_articles() { + $args = array( + 'post_type' => 'post', + 'posts_per_page' => -1, + ); + + $posts = get_posts($args); + + foreach ($posts as $post) { + wp_delete_post($post->ID, true); + } +} + add_action('init', 'supprimer_tous_les_articles'); +*/ diff --git a/package.json b/package.json index 0a105be..565a2be 100644 --- a/package.json +++ b/package.json @@ -24,6 +24,6 @@ "@roots/sage": "6.12.2" }, "dependencies": { - "caniuse-lite": "^1.0.30001487" + "caniuse-lite": "^1.0.30001488" } } diff --git a/resources/views/index.blade.php b/resources/views/index.blade.php index c52e1cf..b63f4b4 100644 --- a/resources/views/index.blade.php +++ b/resources/views/index.blade.php @@ -1,7 +1,58 @@ @extends('layouts.app') @section('content') - @include('partials.page-header') + + + + + + + + + + + + + + + 'post', + 'posts_per_page' => -1, + 'meta_key' => 'Index', + 'meta_type' => 'NUMERIC', + 'orderby' => 'meta_value', + 'order' => 'ASC' + ); + $query = new WP_Query($args); + if ($query->have_posts()) : + while ($query->have_posts()) : $query->the_post(); + ?> + + + + + + + + + +
ImagesVoix Off et InBande SonEcrits
{{ get_post_meta(get_the_ID(), 'Minutage', true) }}{{ get_post_meta(get_the_ID(), 'Images', true) }}{{ get_post_meta(get_the_ID(), 'VoixOffIn', true) }}{{ get_post_meta(get_the_ID(), 'BandeSon', true) }}{{ get_post_meta(get_the_ID(), 'Ecrits', true) }}
+ @if (! have_posts()) @@ -11,15 +62,7 @@ {!! get_search_form(false) !!} @endif - @while(have_posts()) @php(the_post()) - @includeFirst(['partials.content-' . get_post_type(), 'partials.content']) - @endwhile - Test de texte hardcoded - - {!! get_the_posts_navigation() !!} @endsection -@section('sidebar') - @include('sections.sidebar') -@endsection + diff --git a/resources/views/partials/content-single.blade.php b/resources/views/partials/content-single.blade.php index 76cce86..cb1dcea 100644 --- a/resources/views/partials/content-single.blade.php +++ b/resources/views/partials/content-single.blade.php @@ -7,8 +7,57 @@ @include('partials.entry-meta') +
@php(the_content()) + + 'Minutage', + 'contenu' => $minutage, + ], + [ + 'titre' => 'Images', + 'contenu' =>$images, + ], + [ + 'titre' => 'Bande Son', + 'contenu' => $bandeSon, + ], + [ + 'titre' => 'Voix In et Off', + 'contenu' => $voixOffIn, + ], + [ + 'titre' => 'Ecrits', + 'contenu' => $ecrits, + ] + ]; + + ?> + + + + @foreach($listeChamps as $champ) + + + + + @endforeach + +
{{ $champ['titre'] }}{{ $champ['contenu'] }}
+ + + +