Ver código fonte

tableau et champs personnalises

philippelin 1 ano atrás
pai
commit
a4ad086903

+ 32 - 0
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');
+*/

+ 1 - 1
package.json

@@ -24,6 +24,6 @@
     "@roots/sage": "6.12.2"
   },
   "dependencies": {
-    "caniuse-lite": "^1.0.30001487"
+    "caniuse-lite": "^1.0.30001488"
   }
 }

+ 53 - 10
resources/views/index.blade.php

@@ -1,7 +1,58 @@
 @extends('layouts.app')
 
 @section('content')
-  @include('partials.page-header')
+
+<style>
+  tr {
+    border-bottom: 1px solid #000;
+  }
+  tbody tr:last-child {
+    border-bottom: none;
+  }
+  td {
+      padding-left: 10px; /* ou margin-left: 10px; */
+    }
+</style>
+
+  <table >
+    <thead>
+      <tr>
+        <th ></th>
+        <th>Images</th>
+        <th>Voix Off et In</th>
+        <th>Bande Son</th>
+        <th>Ecrits</th>
+      </tr>
+    </thead>
+    <tbody>
+      <?php
+        $args = array(
+          'post_type' => '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();
+      ?>
+          <tr>
+            <td >{{ get_post_meta(get_the_ID(), 'Minutage', true) }}</td>
+            <td>{{ get_post_meta(get_the_ID(), 'Images', true) }}</td>
+            <td>{{ get_post_meta(get_the_ID(), 'VoixOffIn', true) }}</td>
+            <td>{{ get_post_meta(get_the_ID(), 'BandeSon', true) }}</td>
+            <td>{{ get_post_meta(get_the_ID(), 'Ecrits', true) }}</td>
+          </tr>
+       <?php
+          endwhile;
+        endif;
+        wp_reset_postdata();
+      ?>
+    </tbody>
+  </table>
+
 
   @if (! have_posts())
     <x-alert type="warning">
@@ -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
+

+ 49 - 0
resources/views/partials/content-single.blade.php

@@ -7,8 +7,57 @@
     @include('partials.entry-meta')
   </header>
 
+
   <div class="e-content">
     @php(the_content())
+
+    <?php 
+
+    $minutage = get_post_meta(get_the_ID(), 'Minutage', true); 
+    $images = get_post_meta(get_the_ID(), 'Images', true); 
+    $bandeSon = get_post_meta(get_the_ID(), 'BandeSon', true); 
+    $voixOffIn = get_post_meta(get_the_ID(), 'VoixOffIn', true);
+    $ecrits = get_post_meta(get_the_ID(), 'Ecrits', true);
+    
+      $listeChamps = [
+      [
+          'titre' => 'Minutage',
+          'contenu' => $minutage,
+      ],
+      [
+          'titre' => 'Images',
+          'contenu' =>$images,
+      ],
+      [
+          'titre' => 'Bande Son',
+          'contenu' => $bandeSon,
+      ],
+      [
+          'titre' => 'Voix In et Off',
+          'contenu' => $voixOffIn,
+      ],
+      [
+          'titre' => 'Ecrits',
+          'contenu' => $ecrits,
+      ]
+      ];
+    
+    ?>
+
+    <table style="border-collapse: collapse;">
+      <tbody>
+          @foreach($listeChamps as $champ)
+              <tr>
+                  <th style="border: 1px solid black; padding: 5px;">{{ $champ['titre'] }}</th>
+                  <td style="border: 1px solid black; padding: 5px;">{{ $champ['contenu'] }}</td>
+              </tr>
+          @endforeach
+      </tbody>
+    </table>
+
+
+
+   
   </div>
 
   <footer>

+ 9 - 4
yarn.lock

@@ -4007,10 +4007,15 @@ caniuse-api@^3.0.0:
     lodash.memoize "^4.1.2"
     lodash.uniq "^4.5.0"
 
-caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001286, caniuse-lite@^1.0.30001332, caniuse-lite@^1.0.30001359, caniuse-lite@^1.0.30001400, caniuse-lite@^1.0.30001449, caniuse-lite@^1.0.30001464, caniuse-lite@^1.0.30001487:
-  version "1.0.30001487"
-  resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001487.tgz#d882d1a34d89c11aea53b8cdc791931bdab5fe1b"
-  integrity sha512-83564Z3yWGqXsh2vaH/mhXfEM0wX+NlBCm1jYHOb97TrTWJEmPTccZgeLTPBUUb0PNVo+oomb7wkimZBIERClA==
+caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001286, caniuse-lite@^1.0.30001332, caniuse-lite@^1.0.30001359, caniuse-lite@^1.0.30001400, caniuse-lite@^1.0.30001449, caniuse-lite@^1.0.30001464:
+  version "1.0.30001488"
+  resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001488.tgz"
+  integrity sha512-NORIQuuL4xGpIy6iCCQGN4iFjlBXtfKWIenlUuyZJumLRIindLb7wXM+GO8erEhb7vXfcnf4BAg2PrSDN5TNLQ==
+
+caniuse-lite@^1.0.30001488:
+  version "1.0.30001488"
+  resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001488.tgz#d19d7b6e913afae3e98f023db97c19e9ddc5e91f"
+  integrity sha512-NORIQuuL4xGpIy6iCCQGN4iFjlBXtfKWIenlUuyZJumLRIindLb7wXM+GO8erEhb7vXfcnf4BAg2PrSDN5TNLQ==
 
 ccount@^2.0.0:
   version "2.0.1"