Advertisement
Guest User

Untitled

a guest
Jun 6th, 2018
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 22.71 KB | None | 0 0
  1. <?php
  2. /**
  3.  * Register Meta Boxes
  4.  */
  5. add_filter( 'rwmb_meta_boxes', function( $meta_boxes ) {
  6.  
  7. $prefix = 'cc_';
  8.  
  9. // Admin
  10.   $post_id = isset( $_GET['post'] ) ? $_GET['post'] : ( isset( $_POST['post_ID'] ) ? $_POST['post_ID'] : false );
  11.  
  12. // Front
  13.   if ($post_id == false) {
  14.     global $post;
  15.     if (!empty($post)) {
  16.       $post_id = $post->ID;
  17.     }
  18.   }
  19.  
  20. /** PAGE D'ACCUEIL **/
  21.   if ($post_id == 2) {
  22. $meta_boxes[] = array(
  23.   'revision' => true,
  24.   'id'         => 'hp-nous',
  25.   'title'      => __( 'Section "Nous"', 'purple' ),
  26.   'post_types' => array( 'page' ),
  27.   'autosave'   => true,
  28.   'fields'     => array(
  29.  
  30.     // Titre
  31.     array(
  32.       'name'  => esc_html__( 'Titre', 'langdomain' ),
  33.       'id'    => "{$prefix}text-nous-titre",
  34.       'desc'  => esc_html__( 'Le titre du bloc', 'langdomain' ),
  35.       'type'  => 'text',
  36.     ),
  37.     // Texte
  38.     array(
  39.       'name'  => esc_html__( 'Texte', 'langdomain' ),
  40.       'id'    => "{$prefix}wysiwyg-nous-texte",
  41.       'desc'  => esc_html__( 'Contenu texte du bloc', 'langdomain' ),
  42.       'raw' => false,
  43.       'type'  => 'wysiwyg',
  44.       'options' => array(
  45.         'textarea_rows'  => 4,
  46.         'teeny' => false,
  47.         'media_buttons' => false,
  48.       ),
  49.     ),
  50.     // Lien
  51.     array(
  52.       'name'  => esc_html__( 'Lien', 'langdomain' ),
  53.       'id'    => "{$prefix}post-nous-lien",
  54.       'desc'  => esc_html__( 'Page liée au bouton "Lire la suite"', 'langdomain' ),
  55.       'type'  => 'post',
  56.       'post_type'  => 'page',
  57.       'field_type'  => 'select_advanced',
  58.       'placeholder'  => esc_html__( 'Sélectionner la page liée', 'langdomain' ),
  59.     ),
  60.     // Image
  61.     array(
  62.       'name'  => esc_html__( 'Image', 'langdomain' ),
  63.       'id'    => "{$prefix}image_advanced-nous-image",
  64.       'desc'  => esc_html__( 'La photo du bloc', 'langdomain' ),
  65.       'type'  => 'image_advanced',
  66.       'force_delete' => false,
  67.       'max_file_uploads' => 1,
  68.       'max_status' => false,
  69.     ),
  70.   ),
  71. );
  72.  
  73. $meta_boxes[] = array(
  74.   'revision' => true,
  75.   'id'         => 'hp-vousluielle',
  76.   'title'      => __( 'Section "Vous / Lui / Elle"', 'purple' ),
  77.   'post_types' => array( 'page' ),
  78.   'autosave'   => true,
  79.   'fields'     => array(
  80.  
  81.     // Fiches
  82.     array(
  83.       'name'  => esc_html__( 'Fiches', 'langdomain' ),
  84.       'id'    => "{$prefix}group-vle-fiches",
  85.       'type'  => 'group',
  86.       'add_button' => 'Ajouter une fiche',
  87.       'collapsible' => true,
  88.       'group_title' => array( 'field' => 'cc_text-titre' ),
  89.       'clone' => true,
  90.       'sort_clone' => true,
  91.       'fields'   => array(
  92.         // Titre
  93.         array(
  94.           'name'  => esc_html__( 'Titre', 'langdomain' ),
  95.           'id'    => "{$prefix}text-titre",
  96.           'desc'  => esc_html__( 'Le titre de la fiche', 'langdomain' ),
  97.           'type'  => 'text',
  98.         ),
  99.         // Image
  100.         array(
  101.           'name'  => esc_html__( 'Image', 'langdomain' ),
  102.           'id'    => "{$prefix}image_advanced-image",
  103.           'desc'  => esc_html__( 'L\'image de la fiche', 'langdomain' ),
  104.           'type'  => 'image_advanced',
  105.           'force_delete' => false,
  106.           'max_file_uploads' => 1,
  107.           'max_status' => false,
  108.         ),
  109.         // Texte
  110.         array(
  111.           'name'  => esc_html__( 'Texte', 'langdomain' ),
  112.           'id'    => "{$prefix}wysiwyg-texte",
  113.           'desc'  => esc_html__( 'Le texte de la fiche', 'langdomain' ),
  114.           'raw' => false,
  115.           'type'  => 'wysiwyg',
  116.           'options' => array(
  117.             'textarea_rows'  => 4,
  118.             'teeny' => false,
  119.             'media_buttons' => false,
  120.           ),
  121.         ),
  122.         // Lien
  123.         array(
  124.           'name'  => esc_html__( 'Lien', 'langdomain' ),
  125.           'id'    => "{$prefix}post-lien",
  126.           'desc'  => esc_html__( 'Page liée au bouton "Lire la suite"', 'langdomain' ),
  127.           'type'  => 'post',
  128.           'post_type'  => 'page',
  129.           'field_type'  => 'select_advanced',
  130.           'placeholder'  => esc_html__( 'Sélectionner la page liée', 'langdomain' ),
  131.         ),
  132.       )
  133.     ),
  134.   ),
  135. );
  136.  
  137. $meta_boxes[] = array(
  138.   'revision' => true,
  139.   'id'         => 'hp-ohlesfilles',
  140.   'title'      => __( 'Section "Oh les filles !"', 'purple' ),
  141.   'post_types' => array( 'page' ),
  142.   'autosave'   => true,
  143.   'fields'     => array(
  144.  
  145.     // Titre
  146.     array(
  147.       'name'  => esc_html__( 'Titre', 'langdomain' ),
  148.       'id'    => "{$prefix}text-olf-titre",
  149.       'desc'  => esc_html__( 'Le titre du bloc', 'langdomain' ),
  150.       'type'  => 'text',
  151.     ),
  152.     // Texte
  153.     array(
  154.       'name'  => esc_html__( 'Texte', 'langdomain' ),
  155.       'id'    => "{$prefix}wysiwyg-olf-texte",
  156.       'desc'  => esc_html__( 'Contenu texte du bloc', 'langdomain' ),
  157.       'raw' => false,
  158.       'type'  => 'wysiwyg',
  159.       'options' => array(
  160.         'textarea_rows'  => 4,
  161.         'teeny' => false,
  162.         'media_buttons' => false,
  163.       ),
  164.     ),
  165.     // Lien
  166.     array(
  167.       'name'  => esc_html__( 'Lien', 'langdomain' ),
  168.       'id'    => "{$prefix}post-olf-lien",
  169.       'desc'  => esc_html__( 'Page liée au bouton "Lire la suite"', 'langdomain' ),
  170.       'type'  => 'post',
  171.       'post_type'  => 'page',
  172.       'field_type'  => 'select_advanced',
  173.       'placeholder'  => esc_html__( 'Sélectionner la page liée', 'langdomain' ),
  174.     ),
  175.     // Image
  176.     array(
  177.       'name'  => esc_html__( 'Image', 'langdomain' ),
  178.       'id'    => "{$prefix}image_advanced-olf-image",
  179.       'desc'  => esc_html__( 'La photo du bloc', 'langdomain' ),
  180.       'type'  => 'image_advanced',
  181.       'force_delete' => false,
  182.       'max_file_uploads' => 1,
  183.       'max_status' => false,
  184.     ),
  185.   ),
  186. );
  187.  
  188. $meta_boxes[] = array(
  189.   'revision' => true,
  190.   'id'         => 'hp-mesdamesmessieursseniors',
  191.   'title'      => __( 'Section "Mesdames / Messieurs / Senios"', 'purple' ),
  192.   'post_types' => array( 'page' ),
  193.   'autosave'   => true,
  194.   'fields'     => array(
  195.  
  196.     // Fiches
  197.     array(
  198.       'name'  => esc_html__( 'Fiches', 'langdomain' ),
  199.       'id'    => "{$prefix}group-mms-fiches",
  200.       'type'  => 'group',
  201.       'add_button' => 'Ajouter une fiche',
  202.       'collapsible' => true,
  203.       'group_title' => array( 'field' => 'cc_text-titre' ),
  204.       'clone' => true,
  205.       'sort_clone' => true,
  206.       'fields'   => array(
  207.         // Titre
  208.         array(
  209.           'name'  => esc_html__( 'Titre', 'langdomain' ),
  210.           'id'    => "{$prefix}text-titre",
  211.           'desc'  => esc_html__( 'Le titre de la fiche', 'langdomain' ),
  212.           'type'  => 'text',
  213.         ),
  214.         // Image
  215.         array(
  216.           'name'  => esc_html__( 'Image', 'langdomain' ),
  217.           'id'    => "{$prefix}image_advanced-image",
  218.           'desc'  => esc_html__( 'L\'image de la fiche', 'langdomain' ),
  219.           'type'  => 'image_advanced',
  220.           'force_delete' => false,
  221.           'max_file_uploads' => 1,
  222.           'max_status' => false,
  223.         ),
  224.         // Texte
  225.         array(
  226.           'name'  => esc_html__( 'Texte', 'langdomain' ),
  227.           'id'    => "{$prefix}wysiwyg-texte",
  228.           'desc'  => esc_html__( 'Le texte de la fiche', 'langdomain' ),
  229.           'raw' => false,
  230.           'type'  => 'wysiwyg',
  231.           'options' => array(
  232.             'textarea_rows'  => 4,
  233.             'teeny' => false,
  234.             'media_buttons' => false,
  235.           ),
  236.         ),
  237.         // Lien
  238.         array(
  239.           'name'  => esc_html__( 'Lien', 'langdomain' ),
  240.           'id'    => "{$prefix}post-lien",
  241.           'desc'  => esc_html__( 'Page liée au bouton "Lire la suite"', 'langdomain' ),
  242.           'type'  => 'post',
  243.           'post_type'  => 'page',
  244.           'field_type'  => 'select_advanced',
  245.           'placeholder'  => esc_html__( 'Sélectionner la page liée', 'langdomain' ),
  246.         ),
  247.       )
  248.     ),
  249.   ),
  250. );
  251. }
  252.  
  253. /** PAGE NOUS **/
  254.   if ($post_id == 28) {
  255. $meta_boxes[] = array(
  256.   'revision' => true,
  257.   'id'         => 'nous-intro',
  258.   'title'      => __( 'Section "Intro"', 'purple' ),
  259.   'post_types' => array( 'page' ),
  260.   'autosave'   => true,
  261.   'fields'     => array(
  262.  
  263.     // Texte
  264.     array(
  265.       'name'  => esc_html__( 'Texte', 'langdomain' ),
  266.       'id'    => "{$prefix}wysiwyg-intro-texte",
  267.       'desc'  => esc_html__( 'Contenu texte du bloc', 'langdomain' ),
  268.       'raw' => false,
  269.       'type'  => 'wysiwyg',
  270.       'options' => array(
  271.         'textarea_rows'  => 4,
  272.         'teeny' => false,
  273.         'media_buttons' => false,
  274.       ),
  275.     ),
  276.     // Lien
  277.     array(
  278.       'name'  => esc_html__( 'Lien', 'langdomain' ),
  279.       'id'    => "{$prefix}post-intro-lien",
  280.       'desc'  => esc_html__( 'Page liée au bouton "Lire la suite"', 'langdomain' ),
  281.       'type'  => 'post',
  282.       'post_type'  => 'page',
  283.       'field_type'  => 'select_advanced',
  284.       'placeholder'  => esc_html__( 'Sélectionner la page liée', 'langdomain' ),
  285.     ),
  286.     // Ancre
  287.     array(
  288.       'name'  => esc_html__( 'Ancre', 'langdomain' ),
  289.       'id'    => "{$prefix}text-intro-ancre",
  290.       'desc'  => esc_html__( 'L\'ancre dans la page liée', 'langdomain' ),
  291.       'type'  => 'text',
  292.     ),
  293.     // Image
  294.     array(
  295.       'name'  => esc_html__( 'Image', 'langdomain' ),
  296.       'id'    => "{$prefix}image_advanced-intro-image",
  297.       'desc'  => esc_html__( 'La photo du bloc', 'langdomain' ),
  298.       'type'  => 'image_advanced',
  299.       'force_delete' => false,
  300.       'max_file_uploads' => 1,
  301.       'max_status' => false,
  302.     ),
  303.   ),
  304. );
  305.  
  306. $meta_boxes[] = array(
  307.   'revision' => true,
  308.   'id'         => 'nous-suite',
  309.   'title'      => __( 'Section "Agences / Conseillères / Services +"', 'purple' ),
  310.   'post_types' => array( 'page' ),
  311.   'autosave'   => true,
  312.   'fields'     => array(
  313.  
  314.     // Fiches
  315.     array(
  316.       'name'  => esc_html__( 'Fiches', 'langdomain' ),
  317.       'id'    => "{$prefix}group-acs-fiches",
  318.       'type'  => 'group',
  319.       'add_button' => 'Ajouter une fiche',
  320.       'collapsible' => true,
  321.       'group_title' => array( 'field' => 'cc_text-titre' ),
  322.       'clone' => true,
  323.       'sort_clone' => true,
  324.       'fields'   => array(
  325.         // Titre
  326.         array(
  327.           'name'  => esc_html__( 'Titre', 'langdomain' ),
  328.           'id'    => "{$prefix}text-titre",
  329.           'desc'  => esc_html__( 'Le titre de la fiche', 'langdomain' ),
  330.           'type'  => 'text',
  331.         ),
  332.         // Image
  333.         array(
  334.           'name'  => esc_html__( 'Image', 'langdomain' ),
  335.           'id'    => "{$prefix}image_advanced-image",
  336.           'desc'  => esc_html__( 'L\'image de la fiche', 'langdomain' ),
  337.           'type'  => 'image_advanced',
  338.           'force_delete' => false,
  339.           'max_file_uploads' => 1,
  340.           'max_status' => false,
  341.         ),
  342.         // Texte
  343.         array(
  344.           'name'  => esc_html__( 'Texte', 'langdomain' ),
  345.           'id'    => "{$prefix}wysiwyg-texte",
  346.           'desc'  => esc_html__( 'Le texte de la fiche', 'langdomain' ),
  347.           'raw' => false,
  348.           'type'  => 'wysiwyg',
  349.           'options' => array(
  350.             'textarea_rows'  => 4,
  351.             'teeny' => false,
  352.             'media_buttons' => false,
  353.           ),
  354.         ),
  355.         // Lien
  356.         array(
  357.           'name'  => esc_html__( 'Lien', 'langdomain' ),
  358.           'id'    => "{$prefix}post-lien",
  359.           'desc'  => esc_html__( 'Page liée au bouton "Lire la suite"', 'langdomain' ),
  360.           'type'  => 'post',
  361.           'post_type'  => 'page',
  362.           'field_type'  => 'select_advanced',
  363.           'placeholder'  => esc_html__( 'Sélectionner la page liée', 'langdomain' ),
  364.         ),
  365.         // Ancre
  366.         array(
  367.           'name'  => esc_html__( 'Ancre', 'langdomain' ),
  368.           'id'    => "{$prefix}text-ancre-titre",
  369.           'desc'  => esc_html__( 'L\'ancre dans la page liée', 'langdomain' ),
  370.           'type'  => 'text',
  371.         ),
  372.       )
  373.     ),
  374.   ),
  375. );
  376.  
  377. $meta_boxes[] = array(
  378.   'revision' => true,
  379.   'id'         => 'nous-methode',
  380.   'title'      => __( 'Section "Méthode"', 'purple' ),
  381.   'post_types' => array( 'page' ),
  382.   'autosave'   => true,
  383.   'fields'     => array(
  384.  
  385.     // Titre
  386.     array(
  387.       'name'  => esc_html__( 'Titre', 'langdomain' ),
  388.       'id'    => "{$prefix}text-methode-titre",
  389.       'desc'  => esc_html__( 'Le titre du bloc', 'langdomain' ),
  390.       'type'  => 'text',
  391.     ),
  392.     // Texte
  393.     array(
  394.       'name'  => esc_html__( 'Texte', 'langdomain' ),
  395.       'id'    => "{$prefix}wysiwyg-methode-texte",
  396.       'desc'  => esc_html__( 'Contenu texte du bloc', 'langdomain' ),
  397.       'raw' => false,
  398.       'type'  => 'wysiwyg',
  399.       'options' => array(
  400.         'textarea_rows'  => 4,
  401.         'teeny' => false,
  402.         'media_buttons' => false,
  403.       ),
  404.     ),
  405.     // Lien
  406.     array(
  407.       'name'  => esc_html__( 'Lien', 'langdomain' ),
  408.       'id'    => "{$prefix}post-methode-lien",
  409.       'desc'  => esc_html__( 'Page liée au bouton "Lire la suite"', 'langdomain' ),
  410.       'type'  => 'post',
  411.       'post_type'  => 'page',
  412.       'field_type'  => 'select_advanced',
  413.       'placeholder'  => esc_html__( 'Sélectionner la page liée', 'langdomain' ),
  414.     ),
  415.     // Ancre
  416.     array(
  417.       'name'  => esc_html__( 'Ancre', 'langdomain' ),
  418.       'id'    => "{$prefix}text-methode-ancre",
  419.       'desc'  => esc_html__( 'L\'ancre dans la page liée', 'langdomain' ),
  420.       'type'  => 'text',
  421.     ),
  422.     // Image
  423.     array(
  424.       'name'  => esc_html__( 'Image', 'langdomain' ),
  425.       'id'    => "{$prefix}image_advanced-methode-image",
  426.       'desc'  => esc_html__( 'La photo du bloc', 'langdomain' ),
  427.       'type'  => 'image_advanced',
  428.       'force_delete' => false,
  429.       'max_file_uploads' => 1,
  430.       'max_status' => false,
  431.     ),
  432.   ),
  433. );
  434.  
  435. $meta_boxes[] = array(
  436.   'revision' => true,
  437.   'id'         => 'nous-adhesion',
  438.   'title'      => __( 'Section "Adhésion"', 'purple' ),
  439.   'post_types' => array( 'page' ),
  440.   'autosave'   => true,
  441.   'fields'     => array(
  442.  
  443.     // Titre
  444.     array(
  445.       'name'  => esc_html__( 'Titre', 'langdomain' ),
  446.       'id'    => "{$prefix}text-adhesion-titre",
  447.       'desc'  => esc_html__( 'Le titre du bloc', 'langdomain' ),
  448.       'type'  => 'text',
  449.     ),
  450.     // Texte
  451.     array(
  452.       'name'  => esc_html__( 'Texte', 'langdomain' ),
  453.       'id'    => "{$prefix}wysiwyg-adhesion-texte",
  454.       'desc'  => esc_html__( 'Contenu texte du bloc', 'langdomain' ),
  455.       'raw' => false,
  456.       'type'  => 'wysiwyg',
  457.       'options' => array(
  458.         'textarea_rows'  => 4,
  459.         'teeny' => false,
  460.         'media_buttons' => false,
  461.       ),
  462.     ),
  463.     // Lien
  464.     array(
  465.       'name'  => esc_html__( 'Lien', 'langdomain' ),
  466.       'id'    => "{$prefix}post-adhesion-lien",
  467.       'desc'  => esc_html__( 'Page liée au bouton "Lire la suite"', 'langdomain' ),
  468.       'type'  => 'post',
  469.       'post_type'  => 'page',
  470.       'field_type'  => 'select_advanced',
  471.       'placeholder'  => esc_html__( 'Sélectionner la page liée', 'langdomain' ),
  472.     ),
  473.     // Ancre
  474.     array(
  475.       'name'  => esc_html__( 'Ancre', 'langdomain' ),
  476.       'id'    => "{$prefix}text-ancre-titre",
  477.       'desc'  => esc_html__( 'L\'ancre dans la page liée', 'langdomain' ),
  478.       'type'  => 'text',
  479.     ),
  480.     // Image
  481.     array(
  482.       'name'  => esc_html__( 'Image', 'langdomain' ),
  483.       'id'    => "{$prefix}image_advanced-adhesion-image",
  484.       'desc'  => esc_html__( 'La photo du bloc', 'langdomain' ),
  485.       'type'  => 'image_advanced',
  486.       'force_delete' => false,
  487.       'max_file_uploads' => 1,
  488.       'max_status' => false,
  489.     ),
  490.   ),
  491. );
  492. }
  493.  
  494. /** PAGE NOUS 2 **/
  495.   if ($post_id == 30) {
  496. $meta_boxes[] = array(
  497.   'revision' => true,
  498.   'id'         => 'noussuite-interview',
  499.   'title'      => __( 'Section "Interview"', 'purple' ),
  500.   'post_types' => array( 'page' ),
  501.   'autosave'   => true,
  502.   'fields'     => array(
  503.  
  504.     // Titre
  505.     array(
  506.       'name'  => esc_html__( 'Titre', 'langdomain' ),
  507.       'id'    => "{$prefix}text-interview-titre",
  508.       'desc'  => esc_html__( 'Le titre du bloc', 'langdomain' ),
  509.       'type'  => 'text',
  510.     ),
  511.     // Texte
  512.     array(
  513.       'name'  => esc_html__( 'Texte', 'langdomain' ),
  514.       'id'    => "{$prefix}wysiwyg-interview-texte",
  515.       'desc'  => esc_html__( 'Contenu texte du bloc', 'langdomain' ),
  516.       'raw' => false,
  517.       'type'  => 'wysiwyg',
  518.       'options' => array(
  519.         'textarea_rows'  => 4,
  520.         'teeny' => false,
  521.         'media_buttons' => false,
  522.       ),
  523.     ),
  524.     // Vidéo
  525.     array(
  526.       'name'  => esc_html__( 'Vidéo', 'langdomain' ),
  527.       'id'    => "{$prefix}video-video",
  528.       'type'  => 'video',
  529.       'force_delete' => false,
  530.       'max_file_uploads' => 1,
  531.       'max_status' => false,
  532.     ),
  533.   ),
  534. );
  535.  
  536. $meta_boxes[] = array(
  537.   'revision' => true,
  538.   'id'         => 'noussuite-blocs',
  539.   'title'      => __( 'Les différents blocs', 'purple' ),
  540.   'post_types' => array( 'page' ),
  541.   'autosave'   => true,
  542.   'fields'     => array(
  543.  
  544.     // Blocs
  545.     array(
  546.       'name'  => esc_html__( 'Blocs', 'langdomain' ),
  547.       'id'    => "{$prefix}group-blocs",
  548.       'type'  => 'group',
  549.       'add_button' => 'Ajouter un bloc',
  550.       'collapsible' => true,
  551.       'group_title' => array( 'field' => 'cc_text-titre' ),
  552.       'clone' => true,
  553.       'sort_clone' => true,
  554.       'fields'   => array(
  555.         // Titre
  556.         array(
  557.           'name'  => esc_html__( 'Titre', 'langdomain' ),
  558.           'id'    => "{$prefix}text-titre",
  559.           'desc'  => esc_html__( 'Le titre du bloc', 'langdomain' ),
  560.           'type'  => 'text',
  561.         ),
  562.         // Ancre
  563.         array(
  564.           'name'  => esc_html__( 'Ancre', 'langdomain' ),
  565.           'id'    => "{$prefix}text-ancre",
  566.           'desc'  => esc_html__( 'Le titre du bloc', 'langdomain' ),
  567.           'type'  => 'text',
  568.         ),
  569.         // Image
  570.         array(
  571.           'name'  => esc_html__( 'Image', 'langdomain' ),
  572.           'id'    => "{$prefix}image_advanced-image",
  573.           'desc'  => esc_html__( 'L\'image du bloc', 'langdomain' ),
  574.           'type'  => 'image_advanced',
  575.           'force_delete' => false,
  576.           'max_file_uploads' => 1,
  577.           'max_status' => false,
  578.         ),
  579.         // Texte
  580.         array(
  581.           'name'  => esc_html__( 'Texte', 'langdomain' ),
  582.           'id'    => "{$prefix}wysiwyg-texte",
  583.           'desc'  => esc_html__( 'Le texte du bloc', 'langdomain' ),
  584.           'raw' => false,
  585.           'type'  => 'wysiwyg',
  586.           'options' => array(
  587.             'textarea_rows'  => 4,
  588.             'teeny' => false,
  589.             'media_buttons' => false,
  590.           ),
  591.         ),
  592.       )
  593.     ),
  594.   ),
  595. );
  596. }
  597.  
  598. /** PAGE OH LES FILLES **/
  599.  
  600. if ($post_id == 42) {
  601.  
  602. $meta_boxes[] = array(
  603.   'revision' => true,
  604.   'id'         => 'ohlesfilles-header',
  605.   'title'      => __( 'Section "Header"', 'purple' ),
  606.   'post_types' => array( 'page' ),
  607.   'autosave'   => true,
  608.   'fields'     => array(
  609.  
  610.     // Titre
  611.     array(
  612.       'name'  => esc_html__( 'Incitation appel', 'langdomain' ),
  613.       'id'    => "{$prefix}text-incitationappel",
  614.       'type'  => 'text',
  615.     ),
  616.   ),
  617. );
  618.  
  619. $meta_boxes[] = array(
  620.   'revision' => true,
  621.   'id'         => 'ohlesfilles-fiches',
  622.   'title'      => __( 'Section "Bonheur / Séduction / Solution"', 'purple' ),
  623.   'post_types' => array( 'page' ),
  624.   'autosave'   => true,
  625.   'fields'     => array(
  626.  
  627.     // Fiches
  628.     array(
  629.       'name'  => esc_html__( 'Fiches', 'langdomain' ),
  630.       'id'    => "{$prefix}group-acs-fiches",
  631.       'type'  => 'group',
  632.       'add_button' => 'Ajouter une fiche',
  633.       'collapsible' => true,
  634.       'group_title' => array( 'field' => 'cc_text-haut' ),
  635.       'clone' => true,
  636.       'sort_clone' => true,
  637.       'fields'   => array(
  638.         // Titre
  639.         array(
  640.           'name'  => esc_html__( 'Texte Haut', 'langdomain' ),
  641.           'id'    => "{$prefix}text-haut",
  642.           'desc'  => esc_html__( 'Le texte en haut de la fiche', 'langdomain' ),
  643.           'type'  => 'text',
  644.         ),
  645.         // Image
  646.         array(
  647.           'name'  => esc_html__( 'Image', 'langdomain' ),
  648.           'id'    => "{$prefix}image_advanced-image",
  649.           'desc'  => esc_html__( 'L\'image de la fiche', 'langdomain' ),
  650.           'type'  => 'image_advanced',
  651.           'force_delete' => false,
  652.           'max_file_uploads' => 1,
  653.           'max_status' => false,
  654.         ),
  655.         // Titre
  656.         array(
  657.           'name'  => esc_html__( 'Texte Bas', 'langdomain' ),
  658.           'id'    => "{$prefix}text-bas",
  659.           'desc'  => esc_html__( 'Le texte en bas de la fiche', 'langdomain' ),
  660.           'type'  => 'text',
  661.         ),
  662.         // Lien
  663.         array(
  664.           'name'  => esc_html__( 'Lien', 'langdomain' ),
  665.           'id'    => "{$prefix}post-lien",
  666.           'desc'  => esc_html__( 'Page liée', 'langdomain' ),
  667.           'type'  => 'post',
  668.           'post_type'  => 'page',
  669.           'field_type'  => 'select_advanced',
  670.           'placeholder'  => esc_html__( 'Sélectionner la page liée', 'langdomain' ),
  671.         ),
  672.       )
  673.     ),
  674.   ),
  675. );
  676. }
  677.  
  678. /** LES PAGES **/
  679.   $meta_boxes[] = array(
  680.     'revision' => true,
  681.     'id'         => 'zone-formulaire',
  682.     'title'      => __( 'Zone Formulaire (optionnel)', 'purple' ),
  683.     'post_types' => array( 'page' ),
  684.     'autosave'   => true,
  685.     'fields'     => array(
  686.       // Vidéo (optionnel)
  687.       array(
  688.         'name'  => esc_html__( 'Shortcode du formulaire', 'purple' ),
  689.         'id'    => "{$prefix}wysiwyg-formulaire",
  690.         'type'  => 'text',
  691.       ),
  692.       // Couleur du formulaire
  693.       array(
  694.         'name'  => esc_html__( 'Couleur du formulaire', 'langdomain' ),
  695.         'id'    => "{$prefix}radio-couleur_du_formulaire",
  696.         'type'  => 'radio',
  697.         'options' => array(
  698.           'fushia' => esc_html__( 'Fushia', 'langdomain' ),
  699.           'blue' => esc_html__( 'Bleu', 'langdomain' ),
  700.           'grey' => esc_html__( 'Gris', 'langdomain' ),
  701.         ),
  702.       ),
  703.     ),
  704.   );
  705.  
  706. /** LES PARUTIONS **/
  707.   $meta_boxes[] = array(
  708.     'revision' => true,
  709.     'id'         => 'informations-parutions',
  710.     'title'      => __( 'Informations complémentaires', 'purple' ),
  711.     'post_types' => array( 'parutions' ),
  712.     'autosave'   => true,
  713.     'fields'     => array(
  714.       // Vidéo (optionnel)
  715.       array(
  716.         'name'  => esc_html__( 'Vidéo', 'purple' ),
  717.         'id'    => "{$prefix}url-video",
  718.         'type'  => 'url',
  719.       ),
  720.     ),
  721.   );
  722.  
  723. /** LES TEMOIGNAGES **/
  724. $meta_boxes[] = array(
  725.     'revision' => true,
  726.     'id'         => 'informations-temoignage',
  727.     'title'      => <strong>( 'Informations complémentaires', 'purple' ),
  728.     'post_types' => array( 'temoignages' ),
  729.     'autosave'   => true,
  730.     'fields'     => array(
  731.       // Auteur (optionnel)
  732.       array(
  733.         'name'  => esc_html</strong>( 'Auteur', 'purple' ),
  734.         'id'    => "{$prefix}text-auteur",
  735.         'type'  => 'text',
  736.       ),
  737.     ),
  738.   );
  739.  
  740. return $meta_boxes;
  741. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement