I have also activated safe svg but not working.Can any one help me with this issue. When i am uploading svg icons in backend using icon box it is showing in upload section but not showing in preview mode and front mode. i have added default elementor svg code but still it is not working. can somebody help me with this code it would be great
enter image description here
// Add Your Controll In This Function
protected function register_controls() {
$this->start_controls_section(
'section_content',
[
'label' => esc_html__( 'Content', 'hotelft' ),
]
);
$this->add_control(
'type',
[
'label' => esc_html__( 'Type', 'hotelft' ),
'type' => Controls_Manager::SELECT,
'options' => [
'v1' => esc_html__( 'Type 1', 'hotelft' ),
'v2' => esc_html__( 'Type 2', 'hotelft' ),
],
'default' => 'v1',
]
);
$this->add_control(
'link_to',
[
'label' => esc_html__( 'Link', 'hotelft' ),
'type' => Controls_Manager::SELECT,
'options' => [
'none' => esc_html__( 'None', 'hotelft' ),
'custom' => esc_html__( 'Custom URL', 'hotelft' ),
],
'default' => 'custom',
]
);
$this->add_control(
'link',
[
'label' => esc_html__( 'Link', 'hotelft' ),
'type' => Controls_Manager::URL,
'dynamic' => [
'active' => true,
],
'placeholder' => esc_html__( '', 'hotelft' ),
'condition' => [
'link_to' => 'custom',
],
'show_label' => false,
]
);
$this->add_control(
'icon',
[
'label' => __( 'Icon', 'hotelft' ),
'type' => Controls_Manager::ICONS,
'default' => [
'value' => 'icomoon icomoon-diamond',
'library' => 'icomoon',
],
]
);
$this->add_control(
'icon',
[
'label' => __( 'Icon', 'hotelft' ),
'type' => Controls_Manager::ICONS,
'label_off' => esc_html__( 'Off', 'elementor' ),
'label_on' => esc_html__( 'On', 'elementor' ),
'condition' => [
'value' => 'svg',
'selected_icon[library]' => 'svg',
],
'selectors' => [
'{{WRAPPER}} .elementor-icon-wrapper svg' => 'width: 100%;',
],
]
);
$this->add_control(
'title',
[
'label' => esc_html__( 'Title', 'hotelft' ),
'type' => Controls_Manager::TEXT,
'row' => 5,
'default' => esc_html__('Luxury Amenities','hotelft'),
]
);
$this->add_control(
'description',
[
'label' => esc_html__( 'Description', 'hotelft' ),
'type' => Controls_Manager::TEXTAREA,
'default' => esc_html__( 'We have chosen luxury facilities for our hotel from reliable reputable brands', 'hotelft' ),
'condition' => [
'type' => 'v1'
]
]
);
$this->add_responsive_control(
'align',
[
'label' => esc_html__( 'Alignment', 'hotelft' ),
'type' => Controls_Manager::CHOOSE,
'options' => [
'left' => [
'title' => esc_html__( 'Left', 'hotelft' ),
'icon' => 'eicon-text-align-left',
],
'center' => [
'title' => esc_html__( 'Center', 'hotelft' ),
'icon' => 'eicon-text-align-center',
],
'right' => [
'title' => esc_html__( 'Right', 'hotelft' ),
'icon' => 'eicon-text-align-right',
],
],
'selectors' => [
'{{WRAPPER}} .ova-card' => 'text-align: {{VALUE}};',
'{{WRAPPER}} .ova-card.v2' => 'text-align: {{VALUE}};',
],
'separator' => 'before'
]
);
$this->end_controls_section();
/* Begin icon Style */
$this->start_controls_section(
'icon_style',
[
'label' => esc_html__( 'Icon', 'hotelft' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_responsive_control(
'size_icon',
[
'label' => esc_html__( 'Size', 'hotelft' ),
'type' => Controls_Manager::SLIDER,
'size_units' => [ 'px'],
'range' => [
'px' => [
'min' => 0,
'max' => 100,
'step' => 1,
],
],
'selectors' => [
'{{WRAPPER}} .ova-card .icon i' => 'font-size: {{SIZE}}{{UNIT}};',
],
]
);
$this->add_control(
'icon_color',
[
'label' => esc_html__( 'Color', 'hotelft' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .ova-card .icon i' => 'color: {{VALUE}};',
],
]
);
$this->add_control(
'icon_color_hover',
[
'label' => esc_html__( 'Color Hover', 'hotelft' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .ova-card:hover .icon i' => 'color: {{VALUE}};',
],
]
);
$this->add_responsive_control(
'icon_padding',
[
'label' => esc_html__( 'Padding', 'hotelft' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'em' ],
'selectors' => [
'{{WRAPPER}} .ova-card .icon' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->end_controls_section();
/* End icon style */
}
private function get_link_url( $settings ) {
if ( 'none' === $settings['link_to'] ) {
return false;
}
if ( 'custom' === $settings['link_to'] ) {
if ( empty( $settings['link']['url'] ) ) {
return false;
}
return $settings['link'];
}
return false;
}
// Render Template Here
protected function render() {
$settings = $this->get_settings();
$type = $settings['type'];
$title = $settings['title'];
$description = isset( $settings['description'] ) ? $settings['description'] : '';
$class_icon = $settings['icon']['value'];
$link = $this->get_link_url( $settings );
?>
<?php if(!empty( $link['url'])) : ?>
<?php $nofollow = ( isset( $link['nofollow'] ) && $link['nofollow'] ) ? ' rel="nofollow"' : ''; ?>
<a href="<?php echo esc_url( $link['url'] ); ?> " <?php echo ( isset( $link['is_external'] ) && $link['is_external'] !== '' ) ? ' target="_blank"' : '' ?> <?php echo esc_attr( $nofollow ); ?>>
<?php endif; ?>
<div class="ova-card <?php echo esc_html( $type ); ?>">
<?php if (!empty( $class_icon )): ?>
<div class="icon">
<i class="<?php echo esc_attr( $class_icon ); ?>"></i>
</div>
<?php endif;?>
<?php if (!empty( $title )): ?>
<h3 class="title">
<?php echo esc_html( $title ); ?>
</h3>
<?php endif;?>
<?php if ( $type === 'v1') : ?>
<?php if (!empty( $description )): ?>
<p class="description">
<?php echo esc_html( $description ); ?>
</p>
<?php endif;?>
<?php endif;?>
</div>
<?php if(!empty( $link['url'])) : ?>
</a>
<?php endif; ?>
<?php
}
} $widgets_manager->register( new hotelft_Elementor_Card() );
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744895394a4599663.html
评论列表(0条)