Custom Fields
Re-Envisioned
Support General Using oEmbed field and warning message

This topic contains 5 replies, has 2 voices, and was last updated by  Anh Tran 2 years, 4 months ago.

  • Creator
    Topic
  • #4434

    Venkat
    Participant

    I’m getting this warning message while using oembed field.
    Warning: htmlspecialchars() expects parameter 1 to be string, array given in /path/to/wordpress/wp-includes/formatting.php on line 3670

Viewing 5 replies - 1 through 5 (of 5 total)
  • Author
    Replies
  • #4492

    Venkat
    Participant

    Any updates on this?
    Actually, warning message has been displayed when I use wysiwyg field and leave that field empty (without content), and save, this warning message displays.

    Could you please fix this? Thanks

    #4493

    Anh Tran
    Keymaster

    Sorry, I was thinking this issue is on Github and track there. Please post the code you use to register meta boxes.

    #4912

    Venkat
    Participant

    I was to use the below code to register the meta box.

    array(
    				'id'      => '_gx_flexslider_caption',
    				'name'    => __( 'Caption', 'genex-framework' ),
    				'type'    => 'wysiwyg', 
    				'options' => array(
    					'media_buttons' => false,
    					'quicktags'     => false,
    					
    				), 
    				'columns' => 12,
    			),

    Kindly letus know if you found the solution.

    #4932

    Venkat
    Participant

    Is there any update on this issue? Here is full code

    <?php
    	public function add_meta_boxes( $meta_boxes ) {
    		
    		$flexslider_fields = array(
    			array(
    				'id'      => '_gx_flexslider_type',
    				'name'    => __( 'Type', 'genex-framework' ),
    				'type'    => 'radio',
    				'options' => array(
    					'image' => __( 'Image', 'genex-framework' ),
    					'video' => __( 'Video', 'genex-framework' ),
    					'map' => __( 'Google Map', 'genex-framework' ),
    				),
    				'std'     => 'image',
    			),
    			array(
    				'id'      => '_gx_flexslider_video',
    				'name'    => __( 'Video', 'genex-framework' ),
    				'type'    => 'oembed',
    				'hidden'  => array( '_gx_flexslider_type', '!=', 'video' )
    			), 
    			array(
    				'id'      => '_gx_flexslider_image',
    				'name'    => __( 'Image', 'genex-framework' ),
    				'type'    => 'image_advanced',
    				'max_file_uploads' => 1,
    				'hidden'  => array( '_gx_flexslider_type', '!=', 'image' )
    			),
    			array(
    				'id'      => '_gx_flexslider_map_type',
    				'name'    => __( 'Google Map type', 'genex-framework' ),
    				'type'    => 'radio',
    				'options' => array(
    					'iframe' => __( 'Embed iframe Link', 'genex-framework' ),
    					'api' => __( 'API Key', 'genex-framework' ), 
    				),
    				'hidden'  => array( '_gx_flexslider_type', '!=', 'map' )
    			),
    			array(
    				'id'   => '_gx_flexslider_map_embed',
    				'name' => __( 'Enter Google iframe link', 'genex-framework' ), 
    				'type' => 'text',
    				'hidden'    => array(  
    					'when' => array( 
    						array( '_gx_flexslider_type', '!=', 'map' ),
    						array('_gx_flexslider_map_type','!=', 'iframe'),
    					),
    					'relation' => 'or'
    				),
    			),  
    
    			// Map requires at least one address field (with type = text)
    			array(
    				'id'   => '_gx_flexslider_map_api',
    				'name' => __( 'Enter API Key', 'genex-framework' ), 
    				'type' => 'text',
    				'hidden'=> array(  
    					'when' => array( 
    						array( '_gx_flexslider_type', '!=', 'map' ),
    						array('_gx_flexslider_map_type','!=', 'api'),
    					),
    					'relation' => 'or'
    				),
    				'desc' => sprintf( __('Enter your <a href="%1$s" target="_blank">API key</a>. Your map may not function correctly without one.','genex-framework'),'https://developers.google.com/maps/documentation/javascript/get-api-key'),
    			),
    			array(
    				'id'   => '_gx_flexslider_address',
    				'name' => __( 'Address', 'genex-framework' ), 
    				'type' => 'text', 
    				'hidden'    => array(  
    					'when' => array( 
    						array( '_gx_flexslider_type', '!=', 'map' ),
    						array('_gx_flexslider_map_type','!=', 'api'),
    					),
    					'relation' => 'or' 
    				), 
    			), 
    			  
    			array(
    				'id'      => '_gx_flexslider_caption',
    				'name'    => __( 'Caption', 'genex-framework' ),
    				'type'    => 'wysiwyg', 
    				'options' => array(
    					'media_buttons' => false,
    					'quicktags'     => false,
    					//'textarea_rows' => 5
    				), 
    				'columns' => 12,
    			),
    
    		);
    
    		$meta_boxes[] = array(
    			'title'      => __( 'Slide', 'genex-framework' ),
    			'post_types' => array( 'flexslider' ),
    			'fields'     => array(
    				array(
    					'id'         => '_gx_flexslider_slide',
    					// Group field
    					'type'       => 'group',
    					// Clone whole group?
    					'clone'      => true,
    					// Drag and drop clones to reorder them?
    					'sort_clone' => true,
    					'fields'     => $flexslider_fields
    				),
    			)
    		);
    
    		// Caption settings
    		$meta_boxes[] = array( 
    			'title'      => __( 'Caption Settings', 'genex-framework' ),
    			'post_types' => array( 'flexslider' ),
    			'fields'     => array(
    				array(
    					'id'   => '_gx_flexslider_custom_caption',
    					'name' => __( 'Enable custom caption Settings', 'genex-framework' ),
    					'type' => 'checkbox',
    				),
    				array(
    					'id'     => '_gx_flexslider_caption',
    					'type'   => 'group',  
    					'hidden' => array('_gx_flexslider_custom_caption', false ),
    					'fields' => array(
    						array(
    							'id'   => '_gx_flexslider_caption_bg',
    							'name' => __( 'Caption background color', 'genex-framework' ),
    							'type' => 'color',
    						),
    						array(
    							'id'   => '_gx_flexslider_caption_color',
    							'name' => __( 'Caption font color', 'genex-framework' ),
    							'type' => 'color',
    						),
    						array(
    							'id'      => '_gx_flexslider_caption_alignment',
    							'name'    => __( 'Caption Alignment', 'genex-framework' ),
    							'type'    => 'select',
    							'options' => array(
    								'' =>  __( '-- Select alignment --', 'genex-framework' ),
    								'left'    => __( 'Left', 'genex-framework' ),
    								'right'   => __( 'Right', 'genex-framework' ),
    								'center'  => __( 'Center', 'genex-framework' ),
    								'justify' => __( 'Justify', 'genex-framework' ),
    							),
    							'std'     => '', // Todo
    						),
    						array(
    							'id'      => '_gx_flexslider_caption_transform',
    							'name'    => __( 'Text Transform', 'genex-framework' ),
    							'type'    => 'select',
    							'options' => array(
    								'' =>  __( '-- Select text transform --', 'genex-framework' ),
    								'capitalize'    => __( 'Capitalize', 'genex-framework' ),
    								'uppercase'   => __( 'Uppercase', 'genex-framework' ),
    								'lowercase'  => __( 'Lowercase', 'genex-framework' ),
    								'full-width' => __( 'Full Width', 'genex-framework' ),
    							),
    							'std'     => '', // Todo
    						),
    						array(
    							'id'   => '_gx_flexslider_caption_width',
    							'name' => __( 'Background width', 'genex-framework' ),
    							'type' => 'number',
    							'min'  => 0,
    							'std'  => 0,
    						),
    						array(
    							'id'   => '_gx_flexslider_caption_horizontal_position',
    							'name' => __( 'Background horizontal position', 'genex-framework' ),
    							'type' => 'number',
    							'min'  => 0,
    							'std'  => 0,
    						),
    						array(
    							'id'   => '_gx_flexslider_caption_vertical_position',
    							'name' => __( 'Background vertical position', 'genex-framework' ),
    							'type' => 'number',
    							'min'  => 0,
    							'std'  => 0,
    						),
    					),
    				),
    				array(
    					'id'   => '_gx_flexslider_responsive_caption',
    					'name' => __( 'Responsive Caption Position', 'genex-framework' ),
    					'type' => 'radio',
    					'options' => array(
    						'below'    => __( 'Below Slider', 'genex-framework' ),
    						'infront'   => __( 'Infront of Slider', 'genex-framework' ),
    					),
    					'std' => 'below',
    				),
    
    			),
    		);
    
    		return $meta_boxes;
    
    	}
    
    #5042

    Anh Tran
    Keymaster

    Sorry for the late reply. I missed this topic.

    I found that you’re using 2 fields with the same ID _gx_flexslider_caption (in the 1st meta box and the 2nd one). That makes Meta Box gets the wrong value for the first group, because the value is get from the 2nd one.

    Please change the ID of either field. Make sure all fields have unique IDs, even they’re in different groups/meta boxes.

Viewing 5 replies - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.