【发布时间】:2022-01-25 08:49:02
【问题描述】:
我的 elementor 图标控件图标未显示。当我第一次将小部件拖放到 elementor 编辑部分时,它(图标未显示)不起作用,但是当我更改图标时,它显示正常。有什么问题?我该如何解决这个问题?
<?php
namespace MeetTheTeam\Widgets;
use Elementor\Widget_Base;
use Elementor\Controls_Manager;
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
class MTTTest extends Widget_Base {
public function get_name() {
return 'team-mtt-widgetdd';
}
public function get_title() {
return __( 'Team Sectionsdd', 'meet_the_team' );
}
public function get_icon() {
return 'eicon-image-rollover';
}
public function get_categories() {
return [ 'meet-the-team' ];
}
public function get_script_depends() {
return [ 'meet_the_teamd' ];
}
protected function _register_controls() {
$this->start_controls_section(
'section_icond',
[
'label' => __( 'Icon', 'text-domain' ),
]
);
$repeater = new \Elementor\Repeater();
$repeater->add_control(
'mtt_social_icon_three_sk',
[
'label' => esc_html__( 'Icon', 'meet_the_team' ),
'type' => \Elementor\Controls_Manager::ICONS,
'default' => [
'value' => 'fab fa-linkedin',
'library' => 'solid',
],
]
);
$this->add_control(
'mtt_boxfgfg',
[
'label' => esc_html__( 'Meet The Team', 'meet_the_team' ),
'type' => \Elementor\Controls_Manager::REPEATER,
'fields' => $repeater->get_controls(),
'default' => [
[
'mtt_box_title' => esc_html__( 'Title #1', 'meet_the_team' ),
],
[
'mtt_box_title' => esc_html__( 'Title #2', 'meet_the_team' ),
],
],
'title_field' => `{{{ mtt_box_title }}}`,
]
);
$this->end_controls_section();
}
protected function render() {
$settings = $this->get_settings_for_display();
if ( $settings['mtt_boxfgfg'] ) {
foreach ( $settings['mtt_boxfgfg'] as $item ) {
?>
<div class="test_icon"><i class="<?php echo esc_html($item['mtt_social_icon_three_sk']['value']); ?>"></i></div>
<?php
}
}
}
protected function _content_template() {
?>
<# if ( settings.mtt_boxfgfg.length ) { #>
<# _.each( settings.mtt_boxfgfg, function( item ) { #>
<div class="test_icon"><i class="{{{item['mtt_social_icon_three_sk']['value']}}}"></i></div>
<# }); #>
<# } #>
<?php
}
}
【问题讨论】:
标签: javascript php wordpress elementor wordpress-plugin-creation