elements_manager->add_category( 'hf', [ 'title' => __( 'Header Footer', 'nighty' ), 'icon' => 'fa fa-plug', ] ); \Elementor\Plugin::instance()->elements_manager->add_category( 'nighty', [ 'title' => __( 'Nighty', 'nighty' ), 'icon' => 'fa fa-plug', ] ); } function nighty_enqueue_scripts(){ $files = glob(get_theme_file_path('/assets/js/elementor/*.js')); foreach ($files as $file) { $file_name = wp_basename($file); $handle = str_replace(".js", '', $file_name); $src = get_theme_file_uri('/assets/js/elementor/' . $file_name); if (file_exists($file)) { wp_register_script( 'nighty-elementor-' . $handle, $src, ['jquery'], false, true ); } } } function nighty_include_widgets( $widgets_manager ) { $files = glob(get_theme_file_path('elementor/widgets/*.php')); foreach ($files as $file) { $file = get_theme_file_path('elementor/widgets/' . wp_basename($file)); if (file_exists($file)) { require_once $file; } } } function nighty_add_animations(){ $animations = array( 'Nighty' => array( 'ova-move-up' => esc_html__('Move Up', 'nighty'), 'ova-move-down' => esc_html__( 'Move Down', 'nighty' ), 'ova-move-left' => esc_html__('Move Left', 'nighty'), 'ova-move-right' => esc_html__('Move Right', 'nighty'), 'ova-scale-up' => esc_html__('Scale Up', 'nighty'), 'ova-flip' => esc_html__('Flip', 'nighty'), 'ova-helix' => esc_html__('Helix', 'nighty'), 'ova-popup' => esc_html__( 'PopUp','nighty' ) ), ); return $animations; } function nighty_enqueue_footer_scripts(){ // Font Icon wp_enqueue_style('ovaicon', NIGHTY_URI.'/assets/libs/ovaicon/font/ovaicon.css', array(), null); // Font Flaticon wp_enqueue_style('flaticon', NIGHTY_URI.'/assets/libs/flaticon/font/flaticon_nighty.css', array(), null); } public function nighty_icons_filters_new( $tabs = array() ) { $newicons = []; $font_data['json_url'] = NIGHTY_URI.'/assets/libs/ovaicon/ovaicon.json'; $font_data['name'] = 'ovaicon'; $newicons[ $font_data['name'] ] = [ 'name' => $font_data['name'], 'label' => esc_html__( 'Default', 'nighty' ), 'url' => '', 'enqueue' => '', 'prefix' => 'ovaicon-', 'displayPrefix' => '', 'ver' => '1.0', 'fetchJson' => $font_data['json_url'], ]; // flaticons $flaticon_data['json_url'] = NIGHTY_URI.'/assets/libs/flaticon/flaticon_nighty.json'; $flaticon_data['name'] = 'flaticon'; $newicons[ $flaticon_data['name'] ] = [ 'name' => $flaticon_data['name'], 'label' => esc_html__( 'Flaticon', 'nighty' ), 'url' => '', 'enqueue' => '', 'prefix' => 'flaticon-', 'displayPrefix' => '', 'ver' => '1.0', 'fetchJson' => $flaticon_data['json_url'], ]; return array_merge( $tabs, $newicons ); } // text-editor custom function nighty_text_editor_custom( $element, $args ) { /** @var \Elementor\Element_Base $element */ $element->start_controls_section( 'ova_tabs', [ 'tab' => \Elementor\Controls_Manager::TAB_STYLE, 'label' => esc_html__( 'Ova Text Editor', 'nighty' ), ] ); $element->add_group_control( \Elementor\Group_Control_Typography::get_type(), [ 'name' => 'link_typography', 'selector' => '{{WRAPPER}} a', ] ); $element->add_group_control( \Elementor\Group_Control_Text_Stroke::get_type(), [ 'name' => 'text_stroke', 'selector' => '{{WRAPPER}}', ] ); $element->add_control( 'link_color', [ 'label' => esc_html__( 'Link Color', 'nighty' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} a' => 'color: {{VALUE}};', ], ] ); $element->add_control( 'link_color_hover', [ 'label' => esc_html__( 'Link Color Hover', 'nighty' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} a:hover' => 'color: {{VALUE}};', ], ] ); $element->add_responsive_control( 'text_margin', [ 'label' => esc_html__( 'Margin', 'nighty' ), 'type' => \Elementor\Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em' ], 'selectors' => [ '{{WRAPPER}} p' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $element->add_responsive_control( 'text_padding', [ 'label' => esc_html__( 'Padding', 'nighty' ), 'type' => \Elementor\Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em' ], 'selectors' => [ '{{WRAPPER}} p' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $element->end_controls_section(); } // accordion custom function nighty_accordion_custom( $element, $args ) { /** @var \Elementor\Element_Base $element */ $element->start_controls_section( 'ova_accordion', [ 'tab' => \Elementor\Controls_Manager::TAB_STYLE, 'label' => esc_html__( 'Ova Accordion', 'nighty' ), ] ); // Accordion item options $element->add_control( 'accordion_item_options', [ 'label' => esc_html__( 'Item Options', 'nighty' ), 'type' => \Elementor\Controls_Manager::HEADING, 'separator' => 'before', ] ); $element->add_control( 'accordion_item_background_color', [ 'label' => esc_html__( 'Background Color', 'nighty' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .elementor-accordion .elementor-accordion-item' => 'background-color: {{VALUE}}', ], ] ); $element->add_responsive_control( 'accordion_item_margin', [ 'label' => esc_html__( 'Margin', 'nighty' ), 'type' => \Elementor\Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em' ], 'selectors' => [ '{{WRAPPER}} .elementor-accordion .elementor-accordion-item' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $element->add_group_control( \Elementor\Group_Control_Border::get_type(), [ 'name' => 'accordion_item_border', 'selector' => '{{WRAPPER}} .elementor-accordion .elementor-accordion-item', ] ); $element->add_control( 'accordion_item_border_radius', [ 'label' => esc_html__( 'Border Radius', 'nighty' ), 'type' => \Elementor\Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%' ], 'selectors' => [ '{{WRAPPER}} .elementor-accordion .elementor-accordion-item' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); // Title options $element->add_control( 'title_active_options', [ 'label' => esc_html__( 'Title Active Options', 'nighty' ), 'type' => \Elementor\Controls_Manager::HEADING, 'separator' => 'before', ] ); $element->add_responsive_control( 'title_margin', [ 'label' => esc_html__( 'Margin', 'nighty' ), 'type' => \Elementor\Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em' ], 'selectors' => [ '{{WRAPPER}} .elementor-accordion .elementor-tab-title' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $element->add_group_control( \Elementor\Group_Control_Border::get_type(), [ 'name' => 'title_active_border', 'selector' => '{{WRAPPER}} .elementor-accordion .elementor-tab-title.elementor-active', ] ); // Icon options $element->add_control( 'icon_heading', [ 'label' => esc_html__( 'Icon', 'nighty' ), 'type' => \Elementor\Controls_Manager::HEADING, 'separator' => 'before', ] ); $element->add_responsive_control( 'icon_size', [ 'label' => esc_html__( 'Size', 'nighty' ), 'type' => \Elementor\Controls_Manager::SLIDER, 'size_units' => [ 'px', '%', 'em', 'rem' ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, 'step' => 1, ], '%' => [ 'min' => 0, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} .elementor-accordion .elementor-tab-title .elementor-accordion-icon i' => 'font-size: {{SIZE}}{{UNIT}};', ], ] ); $element->end_controls_section(); } // Remove animations style from Elementor public function nighty_remove_animations_styles() { // Deregister the stylesheet by handle foreach ( $this->nighty_add_animations() as $animations ) { if ( !empty( $animations ) && is_array( $animations ) ) { foreach ( array_keys( $animations ) as $animation ) { wp_deregister_style( 'e-animation-'.$animation ); wp_enqueue_style( 'e-animation-'.$animation, NIGHTY_URI.'/assets/scss/none.css', array(), null); } } } } } return new Nighty_Elementor();