functions.php 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <?php
  2. /*
  3. |--------------------------------------------------------------------------
  4. | Register The Auto Loader
  5. |--------------------------------------------------------------------------
  6. |
  7. | Composer provides a convenient, automatically generated class loader for
  8. | our theme. We will simply require it into the script here so that we
  9. | don't have to worry about manually loading any of our classes later on.
  10. |
  11. */
  12. if (! file_exists($composer = __DIR__.'/vendor/autoload.php')) {
  13. wp_die(__('Error locating autoloader. Please run <code>composer install</code>.', 'sage'));
  14. }
  15. require $composer;
  16. /*
  17. |--------------------------------------------------------------------------
  18. | Register The Bootloader
  19. |--------------------------------------------------------------------------
  20. |
  21. | The first thing we will do is schedule a new Acorn application container
  22. | to boot when WordPress is finished loading the theme. The application
  23. | serves as the "glue" for all the components of Laravel and is
  24. | the IoC container for the system binding all of the various parts.
  25. |
  26. */
  27. if (! function_exists('\Roots\bootloader')) {
  28. wp_die(
  29. __('You need to install Acorn to use this theme.', 'sage'),
  30. '',
  31. [
  32. 'link_url' => 'https://roots.io/acorn/docs/installation/',
  33. 'link_text' => __('Acorn Docs: Installation', 'sage'),
  34. ]
  35. );
  36. }
  37. \Roots\bootloader()->boot();
  38. /*
  39. |--------------------------------------------------------------------------
  40. | Register Sage Theme Files
  41. |--------------------------------------------------------------------------
  42. |
  43. | Out of the box, Sage ships with categorically named theme files
  44. | containing common functionality and setup to be bootstrapped with your
  45. | theme. Simply add (or remove) files from the array below to change what
  46. | is registered alongside Sage.
  47. |
  48. */
  49. collect(['setup', 'filters'])
  50. ->each(function ($file) {
  51. if (! locate_template($file = "app/{$file}.php", true, true)) {
  52. wp_die(
  53. /* translators: %s is replaced with the relative file path */
  54. sprintf(__('Error locating <code>%s</code> for inclusion.', 'sage'), $file)
  55. );
  56. }
  57. });
  58. //ajout des champs personnalisés Minutage et Images; pour les afficher rdv dans le fichier content-single
  59. function ajout_champs() {
  60. add_post_meta(get_the_ID(), 'Index', true);
  61. add_post_meta(get_the_ID(), 'Minutage', true);
  62. add_post_meta(get_the_ID(), 'Images', true);
  63. add_post_meta(get_the_ID(), 'BandeSon', true);
  64. add_post_meta(get_the_ID(), 'Ecrits', true);
  65. add_post_meta(get_the_ID(), 'VoixOffIn', true);
  66. add_post_meta(get_the_ID(), 'isMainPart', true);
  67. add_post_meta(get_the_ID(), 'isSubPart', true);
  68. }
  69. add_action('init', 'ajout_champs');
  70. /*
  71. function supprimer_tous_les_articles() {
  72. $args = array(
  73. 'post_type' => 'post',
  74. 'posts_per_page' => -1,
  75. );
  76. $posts = get_posts($args);
  77. foreach ($posts as $post) {
  78. wp_delete_post($post->ID, true);
  79. }
  80. }
  81. add_action('init', 'supprimer_tous_les_articles');
  82. */