fusion_builder_update_element()

fusion_builder_update_element()

If you want to update any existing element setting options, you can simply use this function and the values will get appended to the existing settings for that element.
The functionCopy to Clipboardfusion_builder_update_element( $shortcode_tag, $param_name, $values_to_append ); 1fusion_builder_update_element( $shortcode_tag, $param_name, $values_to_append );Basic usageCopy to Clipboardfunction update_element_options() {

// Example of how to add or modify options to existing element in Fusion Builder.

if ( function_exists( 'fusion_builder_update_element' ) ) {

fusion_builder_update_element( 'fusion_button', 'color', array( 'cyan' => esc_attr__( 'New - Cyan', 'fusion-builder' ) ) );

fusion_builder_update_element( 'fusion_button', 'color', array( 'black' => esc_attr__( 'New - Black', 'fusion-builder' ) ) );

fusion_builder_update_element( 'fusion_button', 'element_content', 'Sample Button' );

}

}

add_action( 'fusion_builder_before_init', 'update_element_options', 11 );​x 1function update_element_options() {2​3  // Example of how to add or modify options to existing element in Fusion Builder.4​5  if ( function_exists( 'fusion_builder_update_element' ) ) {6​7    fusion_builder_update_element( 'fusion_button', 'color', array( 'cyan' => esc_attr__( 'New - Cyan', 'fusion-builder' ) ) );8​9    fusion_builder_update_element( 'fusion_button', 'color', array( 'black' => esc_attr__( 'New - Black', 'fusion-builder' ) ) );10​11    fusion_builder_update_element( 'fusion_button', 'element_content', 'Sample Button' );12​13 }14​15}16​17add_action( 'fusion_builder_before_init', 'update_element_options', 11 );The above example will add the color option 「Black」 and 「Cyan」 in the colors dropdown for the button element. Which will output the color class name as 「fusion-black」 and 「fusion-cyan」, which you can use to customize the color for your button.
This is a rather simple solution if you want to use the custom color combination buttons on your site.
Function Parameters$shortcode_tag
( string ) Registered shortcode name in Avada Builder.$param_name
( string ) Param name to be altered. Check shortcode to get the param name.$values_to_append
( array | string ) Value to be set as default or append to the existing array.

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注