Advertisement
Guest User

et_metabox

a guest
Apr 22nd, 2018
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 17.61 KB | None | 0 0
  1.  
  2. <?php
  3. add_filter( 'rwmb_meta_boxes', 'your_prefix_register_meta_boxes' );
  4. function your_prefix_register_meta_boxes( $meta_boxes ) {
  5.     $meta_boxes[] = array (
  6.       'title' => 'Configuratore post',
  7.       'post_types' =>   array (
  8.          'post',
  9.       ),
  10.       'context' => 'normal',
  11.       'priority' => 'high',
  12.       'status' => 'draft',
  13.       'autosave' => false,
  14.       'fields' =>   array (
  15.          
  16.         array (
  17.           'id' => 'selettore_categoria',
  18.           'type' => 'taxonomy',
  19.           'name' => 'Selezione categoria',
  20.           'desc' => 'Scegli in quale categoria salvare il post',
  21.           'placeholder' => 'Scegli la categoria',
  22.           'taxonomy' => 'category',
  23.           'field_type' => 'checkbox_tree',
  24.         ),
  25.          
  26.         array (
  27.           'id' => 'gruppo_birra',
  28.           'type' => 'group',
  29.           'name' => 'Specifiche birre',
  30.           'fields' =>       array (
  31.              
  32.             array (
  33.               'id' => 'nome_birra',
  34.               'type' => 'text',
  35.               'name' => 'Nome Birra',
  36.               'desc' => 'Il nome della birra',
  37.               'placeholder' => 'Nome birra',
  38.               '' => '',
  39.               'visible' =>           array (
  40.                 'when' =>             array (
  41.                    
  42.                   array (
  43.                      'selettore_categoria',
  44.                      '=',
  45.                      'cantina',
  46.                   ),
  47.                    
  48.                   array (
  49.                      'selettore_categoria',
  50.                      '=',
  51.                      'Cantina',
  52.                   ),
  53.                    
  54.                   array (
  55.                      'selettore_categoria',
  56.                      '=',
  57.                      'taplist',
  58.                   ),
  59.                    
  60.                   array (
  61.                      'selettore_categoria',
  62.                      '=',
  63.                      'Taplist',
  64.                   ),
  65.                 ),
  66.                 'relation' => 'or',
  67.               ),
  68.             ),
  69.              
  70.             array (
  71.               'id' => 'nome_birrificio',
  72.               'type' => 'text',
  73.               'name' => 'Nome birrificio',
  74.               'desc' => 'Inserire il nome del birrificio con l\'iniziale maiuscola',
  75.               'placeholder' => 'Nome birrificio',
  76.               'visible' =>           array (
  77.                 'when' =>             array (
  78.                    
  79.                   array (
  80.                      'selettore_categoria',
  81.                      '=',
  82.                      'cantina',
  83.                   ),
  84.                    
  85.                   array (
  86.                      'selettore_categoria',
  87.                      '=',
  88.                      'Cantina',
  89.                   ),
  90.                    
  91.                   array (
  92.                      'selettore_categoria',
  93.                      '=',
  94.                      'Taplist',
  95.                   ),
  96.                    
  97.                   array (
  98.                      'selettore_categoria',
  99.                      '=',
  100.                      'Taplist',
  101.                   ),
  102.                 ),
  103.                 'relation' => 'or',
  104.               ),
  105.             ),
  106.              
  107.             array (
  108.               'id' => 'gradazione',
  109.               'type' => 'number',
  110.               'name' => 'Gradazione birra',
  111.               'desc' => 'Inserire la gradazione senza segni (NO: % e nemmeno: °)',
  112.               'step' => '0.1',
  113.               'visible' =>           array (
  114.                 'when' =>             array (
  115.                    
  116.                   array (
  117.                      'selettore_categoria',
  118.                      '=',
  119.                      'taplist',
  120.                   ),
  121.                    
  122.                   array (
  123.                      'selettore_categoria',
  124.                      '=',
  125.                      'Taplist',
  126.                   ),
  127.                    
  128.                   array (
  129.                      'selettore_categoria',
  130.                      '=',
  131.                      'cantina',
  132.                   ),
  133.                    
  134.                   array (
  135.                      'selettore_categoria',
  136.                      '=',
  137.                      'Cantina',
  138.                   ),
  139.                 ),
  140.                 'relation' => 'or',
  141.               ),
  142.             ),
  143.              
  144.             array (
  145.               'id' => 'stile_birra',
  146.               'type' => 'text',
  147.               'name' => 'Stile birra',
  148.               'desc' => 'Inserire lo stile della birra',
  149.               'visible' =>           array (
  150.                 'when' =>             array (
  151.                    
  152.                   array (
  153.                      'selettore_categoria',
  154.                      '=',
  155.                      'taplist',
  156.                   ),
  157.                    
  158.                   array (
  159.                      'selettore_categoria',
  160.                      '=',
  161.                      'Taplist',
  162.                   ),
  163.                    
  164.                   array (
  165.                      'selettore_categoria',
  166.                      '=',
  167.                      'Cantina',
  168.                   ),
  169.                    
  170.                   array (
  171.                      'selettore_categoria',
  172.                      '=',
  173.                      'cantina',
  174.                   ),
  175.                 ),
  176.                 'relation' => 'or',
  177.               ),
  178.             ),
  179.              
  180.             array (
  181.               'id' => 'gusto_prevalente',
  182.               'name' => 'Gusto prevalente',
  183.               'type' => 'radio',
  184.               'desc' => 'Gusto prevalente della birra',
  185.               'inline' => 1,
  186.               'visible' =>           array (
  187.                 'when' =>             array (
  188.                    
  189.                   array (
  190.                      'selettore_categoria',
  191.                      '=',
  192.                      'taplist',
  193.                   ),
  194.                    
  195.                   array (
  196.                      'selettore_categoria',
  197.                      '=',
  198.                      'Taplist',
  199.                   ),
  200.                    
  201.                   array (
  202.                      'selettore_categoria',
  203.                      '=',
  204.                      'Cantina',
  205.                   ),
  206.                    
  207.                   array (
  208.                      'selettore_categoria',
  209.                      '=',
  210.                      'cantina',
  211.                   ),
  212.                 ),
  213.                 'relation' => 'or',
  214.               ),
  215.             ),
  216.              
  217.             array (
  218.               'id' => 'gusto_descrittori',
  219.               'name' => 'Scegli i descrittori della birra',
  220.               'type' => 'checkbox_list',
  221.               'desc' => 'La lista dei descrittori presa da qui: https://www.pintamedicea.com/birra/2017/la-ruota-dei-sapori-di-meilgaard/',
  222.               'options' =>           array (
  223.                 'fruttato' => 'Fruttato',
  224.                 'floreale' => 'Floreale',
  225.                 'luppolato' => 'Luppolato',
  226.                 'resinoso' => 'Resinoso',
  227.                 'alcolico' => 'Alcolico/Solvente',
  228.                 'malto' => 'Malto',
  229.                 'caramello' => 'Caramello',
  230.                 'tostato' => 'Tostato/Bruciato',
  231.                 'acido' => 'Acido',
  232.                 'dolce' => 'Dolce',
  233.                 'amaro' => 'Amaro',
  234.                 'astringente' => 'Astringente',
  235.               ),
  236.               'inline' => 1,
  237.               'visible' =>           array (
  238.                 'when' =>             array (
  239.                    
  240.                   array (
  241.                      'selettore_categoria',
  242.                      '=',
  243.                      'taplist',
  244.                   ),
  245.                    
  246.                   array (
  247.                      'selettore_categoria',
  248.                      '=',
  249.                      'Taplist',
  250.                   ),
  251.                    
  252.                   array (
  253.                      'selettore_categoria',
  254.                      '=',
  255.                      'cantina',
  256.                   ),
  257.                    
  258.                   array (
  259.                      'selettore_categoria',
  260.                      '=',
  261.                      'Cantina',
  262.                   ),
  263.                 ),
  264.                 'relation' => 'or',
  265.               ),
  266.             ),
  267.              
  268.             array (
  269.               'id' => 'prezzo_birra',
  270.               'type' => 'number',
  271.               'name' => 'Costo birra',
  272.               'desc' => 'A quanto vendiamo quella birra? Senza simboli',
  273.               'step' => '0.1',
  274.               'visible' =>           array (
  275.                 'when' =>             array (
  276.                    
  277.                   array (
  278.                      'selettore_categoria',
  279.                      '=',
  280.                      'taplist',
  281.                   ),
  282.                    
  283.                   array (
  284.                      'selettore_categoria',
  285.                      '=',
  286.                      'Taplist',
  287.                   ),
  288.                    
  289.                   array (
  290.                      'selettore_categoria',
  291.                      '=',
  292.                      'cantina',
  293.                   ),
  294.                    
  295.                   array (
  296.                      'selettore_categoria',
  297.                      '=',
  298.                      'Cantina',
  299.                   ),
  300.                 ),
  301.                 'relation' => 'or',
  302.               ),
  303.             ),
  304.              
  305.             array (
  306.               'id' => 'disponibilita',
  307.               'name' => 'Disponibilità',
  308.               'type' => 'checkbox',
  309.               'desc' => 'Disponibile o no?',
  310.               'std' => 1,
  311.               'visible' =>           array (
  312.                 'when' =>             array (
  313.                    
  314.                   array (
  315.                      'selettore_categoria',
  316.                      '=',
  317.                      'taplist',
  318.                   ),
  319.                    
  320.                   array (
  321.                      'selettore_categoria',
  322.                      '=',
  323.                      'Taplist',
  324.                   ),
  325.                    
  326.                   array (
  327.                      'selettore_categoria',
  328.                      '=',
  329.                      'Cantina',
  330.                   ),
  331.                    
  332.                   array (
  333.                      'selettore_categoria',
  334.                      '=',
  335.                      'cantina',
  336.                   ),
  337.                 ),
  338.                 'relation' => 'or',
  339.               ),
  340.             ),
  341.              
  342.             array (
  343.               'id' => 'formato_birra',
  344.               'name' => 'Formati disponibili',
  345.               'type' => 'checkbox_list',
  346.               'desc' => 'Che formati sono disponibili?',
  347.               'options' =>           array (
  348.                 '33cl' => '33cl',
  349.                 '375cl' => '37.5cl',
  350.                 '50cl' => '50cl',
  351.                 '75cl' => '75cl',
  352.                 'magnum' => 'Magnum',
  353.                 'fusto' => 'Fusto',
  354.               ),
  355.               'inline' => 1,
  356.               'visible' =>           array (
  357.                 'when' =>             array (
  358.                    
  359.                   array (
  360.                      'selettore_categoria',
  361.                      '=',
  362.                      'taplist',
  363.                   ),
  364.                    
  365.                   array (
  366.                      'selettore_categoria',
  367.                      '=',
  368.                      'Taplist',
  369.                   ),
  370.                    
  371.                   array (
  372.                      'selettore_categoria',
  373.                      '=',
  374.                      'Cantina',
  375.                   ),
  376.                    
  377.                   array (
  378.                      'selettore_categoria',
  379.                      '=',
  380.                      'cantina',
  381.                   ),
  382.                 ),
  383.                 'relation' => 'or',
  384.               ),
  385.             ),
  386.              
  387.             array (
  388.               'id' => 'quantita_birra',
  389.               'type' => 'text',
  390.               'name' => 'Quantità birra',
  391.               'desc' => 'Quante ne hai in magazzino o cella?',
  392.               'placeholder' => 'Quante ne hai?',
  393.               'visible' =>           array (
  394.                 'when' =>             array (
  395.                    
  396.                   array (
  397.                      'selettore_categoria',
  398.                      '=',
  399.                      'taplist',
  400.                   ),
  401.                    
  402.                   array (
  403.                      'selettore_categoria',
  404.                      '=',
  405.                      'Taplist',
  406.                   ),
  407.                    
  408.                   array (
  409.                      'selettore_categoria',
  410.                      '=',
  411.                      'cantina',
  412.                   ),
  413.                    
  414.                   array (
  415.                      'selettore_categoria',
  416.                      '=',
  417.                      'Cantina',
  418.                   ),
  419.                 ),
  420.                 'relation' => 'or',
  421.               ),
  422.             ),
  423.              
  424.             array (
  425.               'id' => 'annata_birra',
  426.               'type' => 'number',
  427.               'name' => 'Annata birra',
  428.               'desc' => 'Di che annate sono le birre che hai?',
  429.               'clone' => 1,
  430.               'sort_clone' => true,
  431.               'visible' =>           array (
  432.                 'when' =>             array (
  433.                    
  434.                   array (
  435.                      'selettore_categoria',
  436.                      '=',
  437.                      'cantina',
  438.                   ),
  439.                    
  440.                   array (
  441.                      'selettore_categoria',
  442.                      '=',
  443.                      'Cantina',
  444.                   ),
  445.                    
  446.                   array (
  447.                      'selettore_categoria',
  448.                      '=',
  449.                      'taplist',
  450.                   ),
  451.                    
  452.                   array (
  453.                      'selettore_categoria',
  454.                      '=',
  455.                      'Taplist',
  456.                   ),
  457.                 ),
  458.                 'relation' => 'or',
  459.               ),
  460.             ),
  461.           ),
  462.         ),
  463.          
  464.         array (
  465.           'id' => 'gruppo_panini',
  466.           'type' => 'group',
  467.           'name' => 'Specifiche panini',
  468.           'fields' =>       array (
  469.              
  470.             array (
  471.               'id' => 'link_youtube',
  472.               'type' => 'oembed',
  473.               'name' => 'Link YouTube',
  474.               'desc' => 'Link alla canzone',
  475.               'visible' =>           array (
  476.                 'when' =>             array (
  477.                    
  478.                   array (
  479.                      'selettore_categoria',
  480.                      '=',
  481.                      'menu',
  482.                   ),
  483.                    
  484.                   array (
  485.                      'selettore_categoria',
  486.                      '=',
  487.                      'Menu',
  488.                   ),
  489.                    
  490.                   array (
  491.                      'selettore_categoria',
  492.                      '=',
  493.                      'bun',
  494.                   ),
  495.                    
  496.                   array (
  497.                      'selettore_categoria',
  498.                      '=',
  499.                      'Bun',
  500.                   ),
  501.                 ),
  502.                 'relation' => 'or',
  503.               ),
  504.             ),
  505.              
  506.             array (
  507.               'id' => 'img_low_res',
  508.               'type' => 'single_image',
  509.               'name' => 'Immagine a bassa qualità',
  510.               'desc' => 'Carica qui l\'immagine a bassa qualità',
  511.               'visible' =>           array (
  512.                 'when' =>             array (
  513.                    
  514.                   array (
  515.                      'selettore_categoria',
  516.                      '=',
  517.                      'bun',
  518.                   ),
  519.                    
  520.                   array (
  521.                      'selettore_categoria',
  522.                      '=',
  523.                      'Bun',
  524.                   ),
  525.                    
  526.                   array (
  527.                      'selettore_categoria',
  528.                      '=',
  529.                      'Menu',
  530.                   ),
  531.                    
  532.                   array (
  533.                      'selettore_categoria',
  534.                      '=',
  535.                      'menu',
  536.                   ),
  537.                 ),
  538.                 'relation' => 'or',
  539.               ),
  540.             ),
  541.              
  542.             array (
  543.               'id' => 'img_high_res',
  544.               'type' => 'single_image',
  545.               'name' => 'Immagine alta qualità',
  546.               'desc' => 'Carica qui l\'immagine ad alta qualità',
  547.               'visible' =>           array (
  548.                 'when' =>             array (
  549.                    
  550.                   array (
  551.                      'selettore_categoria',
  552.                      '=',
  553.                      'bun',
  554.                   ),
  555.                    
  556.                   array (
  557.                      'selettore_categoria',
  558.                      '=',
  559.                      'Bun',
  560.                   ),
  561.                    
  562.                   array (
  563.                      'selettore_categoria',
  564.                      '=',
  565.                      'Menu',
  566.                   ),
  567.                    
  568.                   array (
  569.                      'selettore_categoria',
  570.                      '=',
  571.                      'menu',
  572.                   ),
  573.                 ),
  574.                 'relation' => 'or',
  575.               ),
  576.             ),
  577.           ),
  578.         ),
  579.       ),
  580.       'id' => 'configuratore-spine',
  581.     );
  582.  
  583.     return $meta_boxes;
  584. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement