Submit
Path:
~
/
home
/
getwphos
/
www
/
almajd14
/
wp-content
/
plugins
/
halstein-core
/
inc
/
widgets
/
title
/
File Content:
class-halsteincore-title-widget.php
<?php if ( ! function_exists( 'halstein_core_add_title_widget' ) ) { /** * Function that add widget into widgets list for registration * * @param array $widgets * * @return array */ function halstein_core_add_title_widget( $widgets ) { $widgets[] = 'HalsteinCore_Title_Widget'; return $widgets; } add_filter( 'halstein_core_filter_register_widgets', 'halstein_core_add_title_widget' ); } if ( class_exists( 'QodeFrameworkWidget' ) ) { class HalsteinCore_Title_Widget extends QodeFrameworkWidget { public function map_widget() { $this->set_base( 'halstein_core_title_widget' ); $this->set_name( esc_html__( 'Halstein Title', 'halstein-core' ) ); $this->set_description( esc_html__( 'Add title element into widget areas', 'halstein-core' ) ); $this->set_widget_option( array( 'field_type' => 'text', 'name' => 'title', 'title' => esc_html__( 'Title', 'halstein-core' ), 'default_value' => esc_html__( 'Title', 'halstein-core' ), ) ); $this->set_widget_option( array( 'field_type' => 'select', 'name' => 'title_tag', 'title' => esc_html__( 'Title Tag', 'halstein-core' ), 'options' => halstein_core_get_select_type_options_pool( 'title_tag' ), ) ); $this->set_widget_option( array( 'field_type' => 'text', 'name' => 'margin_bottom', 'title' => esc_html__( 'Bottom Margin', 'halstein-core' ), ) ); $this->set_widget_option( array( 'field_type' => 'text', 'name' => 'width', 'title' => esc_html__( 'Width', 'halstein-core' ), ) ); $this->set_widget_option( array( 'field_type' => 'color', 'name' => 'color', 'title' => esc_html__( 'Color', 'halstein-core' ), ) ); } public function render( $atts ) { $title = $atts['title']; $title_tag = ! empty( $atts['title_tag'] ) ? $atts['title_tag'] : 'h4'; $title_styles = $this->get_title_styles( $atts ); ?> <?php if ( ! empty( $title ) ) : ?> <?php echo '<' . halstein_core_escape_title_tag( $title_tag ); ?> class="qodef-widget-title" <?php qode_framework_inline_style( $title_styles ); ?>> <?php echo esc_html( $title ); ?> <?php echo '</' . halstein_core_escape_title_tag( $title_tag ); ?>> <?php endif; ?> <?php } public function get_title_styles( $atts ) { $styles = array(); $margin_bottom = $atts['margin_bottom']; if ( ! empty( $margin_bottom ) ) { if ( qode_framework_string_ends_with_space_units( $margin_bottom ) ) { $styles[] = 'margin-bottom: ' . $margin_bottom; } else { $styles[] = 'margin-bottom: ' . intval( $margin_bottom ) . 'px'; } } $width = $atts['width']; if ( ! empty( $width ) ) { if ( qode_framework_string_ends_with_space_units( $width ) ) { $styles[] = 'width: ' . $width; } else { $styles[] = 'width: ' . intval( $width ) . 'px'; } } $color = $atts['color']; if ( ! empty( $color ) ) { $styles[] = 'color: ' . $color; } return implode( ';', $styles ); } } }
Edit
Rename
Chmod
Delete
FILE
FOLDER
Name
Size
Permission
Action
class-halsteincore-title-widget.php
3125 bytes
0644
include.php
99 bytes
0644
N4ST4R_ID | Naxtarrr