如何将设置放到前台?我需要向vc_row添加类。

/** * Ken Burns对行的影响。*/
add_action( 'vc_after_init','ken_burns_effect_add_option_to_vc_row‘);
function ken_burns_effect_add_option_to_vc_row() {
// Ken Burns Effect Attributes
$ken_burns_effect_attributes =
array(
array(
'type' => 'checkbox',
'heading' => __( 'Ken Burns for image background', 'ken_burns_effect' ),
'param_name' => 'enable_ken_burns_effect',
'value' => array(
__( 'Yes', 'ken_burns_effect' ) => 'yes',
),
'description' => 'Check this box if you want to enable ken burns effect for this row.',
),
array(
'type' => 'dropdown',
'heading' => __( 'Direction', 'ken_burns_effect' ),
'param_name' => 'direction_ken_burns_effect',
'value' => array(
'Zoom In' => 'zoom_in',
'Zoom Out' => 'zoom_out',
),
'description' => __( '', 'ken_burns_effect' ),
'dependency' => array(
'element' => 'enable_ken_burns_effect',
'value' => array( 'yes' ),
),
),
array(
'type' => 'textfield',
'heading' => __( 'Transition speed', 'ken_burns_effect' ),
'param_name' => 'transition_speed_ken_burns_effect',
'value' => '',
'description' => __( '', 'ken_burns_effect' ),
'dependency' => array(
'element' => 'enable_ken_burns_effect',
'value' => array( 'yes' ),
),
),
);
vc_add_params( 'vc_row', $ken_burns_effect_attributes);
}发布于 2021-04-07 17:10:32
您必须通过将vc_row.php复制到您的主题或插件来覆盖它。您可以查看他们的文档,了解如何设置覆盖目录:https://kb.wpbakery.com/docs/inner-api/vc_set_shortcodes_templates_dir/
然后,您可以在vc_row.php中通过它们的param_name使用您的自定义参数,例如:
$enable_ken_burns_effect;
$direction_ken_burns_effect;
$transition_speed_ken_burns_effect;请记住,如果您想在vc_row_inner.php中使用选项,也必须覆盖它。section和columns__也是如此。
https://stackoverflow.com/questions/60285484
复制相似问题