Support

Account

Forum Replies Created

  • Alright, I completely forgot about that.
    I hope it’ll help you but to resolve my problem it looks like I just changed the way to call my template.

    add_action('acf/init', 'bwb_content_gallery');
    function bwb_content_gallery() {
    
       // Check function exists.
    	if( function_exists('acf_register_block_type') ) {
    
    		// register a testimonial block.
    		acf_register_block_type(array(
    			'name'              => 'bwb_gallery',
    			'title'             => __('Galerie Lexuberance'),
    			'description'       => __(''),
    			'render_template'   => './templates/blocks/gallery.php',
    			'category'          => 'formating',
    			'icon'              => 'schedule',
    			'keywords'          => array( 'gallery', 'lexuberance' ),
    			'mode'				  => 'edit',
    			'enqueue_style'     => get_template_directory_uri() . '/dist/css/blocks.css',
    		));
    	}
    }

    As you can see in “render_template” I directly put the path to the template I want to see and it does work.

  • I found the solution, I just had to add a little ‘[]’ at the end of my select name

    
    <select name='<?php echo $field[‘name’] ?>[]’ id=”select_list_formateur” class=”chosen-select” multiple=”multiple”>
    
  • Thank you Jdorner but when I var_dump the $_POST before updating my post my field has only one value instead of an array with the multiple values selected before.

    In your exemple you write in hard code the values before updating the field but I cant.

    I might have poorly explain my problem and I’m sorry for that.

    I created a multiple values select field but when I update my post only one value is saved in the DB. I wrote a tiny script to see the value of the select on change and when I selected two or three values, the select values are good. But when I update my post, the value in $_POST is not correct, there’s only the first value selected.

    I’m sorry it’s a little bit confusing but I dont really know what to say.

Viewing 3 posts - 1 through 3 (of 3 total)