php 将自定义控件添加到现有Elementor窗口小部件

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php 将自定义控件添加到现有Elementor窗口小部件相关的知识,希望对你有一定的参考价值。

<?php
// This example will add a custom "select" drop down to the "Image Box" 
// This will change the class="" on the rendered image box so we can style the Image Box differently
// based on the selected option from the editor.
// The class will be "my-image-box-style-blue" or "my-image-box-style-green" based on the selected option.

add_action('elementor/element/before_section_end', function( $section, $section_id, $args ) {
	if( $section->get_name() == 'image-box' && $section_id == 'section_image' ){
		// we are at the end of the "section_image" area of the "image-box"
		$section->add_control(
			'my_custom_control' ,
			[
				'label'        => 'My Label Here',
				'type'         => Elementor\Controls_Manager::SELECT,
				'default'      => 'blue',
				'options'      => array( 'blue' => 'Blue Style', 'green' => 'Green Style' ),
				'prefix_class' => 'my-image-box-style-',
				'label_block'  => true,
			]
		);
	}
}, 10, 3 );

以上是关于php 将自定义控件添加到现有Elementor窗口小部件的主要内容,如果未能解决你的问题,请参考以下文章

Sharepoint 将自定义控件添加到 Web 部件错误

如何将自定义控件派生的 TabItem 添加到 WPF 中的 TabControl?

使用带有引导程序的 dataTables 将自定义控件附加到 dom

如何将自定义 UIViewController 添加到现有的 XIB?

php 将自定义列添加到管理表

php 将自定义字段内容添加到菜单项