first commit
This commit is contained in:
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
|
||||
class CallaElatedAuthorInfoWidget extends CallaElatedWidget {
|
||||
public function __construct() {
|
||||
parent::__construct(
|
||||
'eltdf_author_info_widget',
|
||||
esc_html__( 'Elated Author Info Widget', 'calla' ),
|
||||
array( 'description' => esc_html__( 'Add author info element to widget areas', 'calla' ) )
|
||||
);
|
||||
|
||||
$this->setParams();
|
||||
}
|
||||
|
||||
protected function setParams() {
|
||||
$this->params = array(
|
||||
array(
|
||||
'type' => 'textfield',
|
||||
'name' => 'extra_class',
|
||||
'title' => esc_html__( 'Custom CSS Class', 'calla' )
|
||||
),
|
||||
array(
|
||||
'type' => 'textfield',
|
||||
'name' => 'author_username',
|
||||
'title' => esc_html__( 'Author Username', 'calla' )
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public function widget( $args, $instance ) {
|
||||
extract( $args );
|
||||
|
||||
$extra_class = '';
|
||||
if ( ! empty( $instance['extra_class'] ) ) {
|
||||
$extra_class = $instance['extra_class'];
|
||||
}
|
||||
|
||||
$authorID = 1;
|
||||
if ( ! empty( $instance['author_username'] ) ) {
|
||||
$author = get_user_by( 'login', $instance['author_username'] );
|
||||
|
||||
if ( $author ) {
|
||||
$authorID = $author->ID;
|
||||
}
|
||||
}
|
||||
|
||||
$author_info = get_the_author_meta( 'email', $authorID );
|
||||
|
||||
?>
|
||||
|
||||
<div class="widget eltdf-author-info-widget <?php echo esc_attr( $extra_class ); ?>">
|
||||
<div class="eltdf-aiw-inner">
|
||||
<a itemprop="url" class="eltdf-aiw-image" href="<?php echo esc_url( get_author_posts_url( $authorID ) ); ?>">
|
||||
<?php echo calla_elated_kses_img( get_avatar( $authorID, 225 ) ); ?>
|
||||
</a>
|
||||
<?php if ( $author_info !== "" ) { ?>
|
||||
<h4 class="eltdf-aiw-title"><?php echo esc_html($instance['author_username']);?></h4>
|
||||
<span itemprop="description" class="eltdf-aiw-text"><p><?php echo wp_kses_post( $author_info ); ?></p></span>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="<?php echo get_the_author_meta( 'instagram' );?>" >
|
||||
<span class="eltdf-social-network-icon social_instagram"></span>
|
||||
</a>
|
||||
</li><li>
|
||||
<a href="<?php echo get_the_author_meta( 'twitter' );?>" >
|
||||
<span class="eltdf-social-network-icon social_twitter"></span>
|
||||
</a>
|
||||
</li><li>
|
||||
<a href="<?php echo get_the_author_meta( 'facebook' );?>" >
|
||||
<span class="eltdf-social-network-icon social_facebook"></span>
|
||||
</a>
|
||||
</li><li>
|
||||
<a href="<?php echo get_the_author_meta( 'linkedin' );?>" >
|
||||
<span class="eltdf-social-network-icon social_linkedin"></span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
if ( ! function_exists( 'calla_elated_register_author_info_widget' ) ) {
|
||||
/**
|
||||
* Function that register author info widget
|
||||
*/
|
||||
function calla_elated_register_author_info_widget( $widgets ) {
|
||||
$widgets[] = 'CallaElatedAuthorInfoWidget';
|
||||
|
||||
return $widgets;
|
||||
}
|
||||
|
||||
add_filter( 'calla_core_register_widgets', 'calla_elated_register_author_info_widget' );
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
|
||||
include_once ELATED_FRAMEWORK_MODULES_ROOT_DIR . '/widgets/author-info/functions.php';
|
||||
require_once ELATED_FRAMEWORK_MODULES_ROOT_DIR . '/widgets/author-info/author-info.php';
|
||||
@@ -0,0 +1,103 @@
|
||||
<?php
|
||||
|
||||
class CallaElatedBlogListWidget extends CallaElatedWidget {
|
||||
public function __construct() {
|
||||
parent::__construct(
|
||||
'eltdf_blog_list_widget',
|
||||
esc_html__( 'Elated Blog List Widget', 'calla' ),
|
||||
array( 'description' => esc_html__( 'Display a list of your blog posts', 'calla' ) )
|
||||
);
|
||||
|
||||
$this->setParams();
|
||||
}
|
||||
|
||||
protected function setParams() {
|
||||
$this->params = array(
|
||||
array(
|
||||
'type' => 'textfield',
|
||||
'name' => 'widget_title',
|
||||
'title' => esc_html__( 'Widget Title', 'calla' )
|
||||
),
|
||||
array(
|
||||
'type' => 'dropdown',
|
||||
'name' => 'type',
|
||||
'title' => esc_html__( 'Type', 'calla' ),
|
||||
'options' => array(
|
||||
'simple' => esc_html__( 'Simple', 'calla' ),
|
||||
'minimal' => esc_html__( 'Minimal', 'calla' )
|
||||
)
|
||||
),
|
||||
array(
|
||||
'type' => 'textfield',
|
||||
'name' => 'number_of_posts',
|
||||
'title' => esc_html__( 'Number of Posts', 'calla' )
|
||||
),
|
||||
array(
|
||||
'type' => 'dropdown',
|
||||
'name' => 'space_between_items',
|
||||
'title' => esc_html__( 'Space Between Items', 'calla' ),
|
||||
'options' => calla_elated_get_space_between_items_array()
|
||||
),
|
||||
array(
|
||||
'type' => 'dropdown',
|
||||
'name' => 'orderby',
|
||||
'title' => esc_html__( 'Order By', 'calla' ),
|
||||
'options' => calla_elated_get_query_order_by_array()
|
||||
),
|
||||
array(
|
||||
'type' => 'dropdown',
|
||||
'name' => 'order',
|
||||
'title' => esc_html__( 'Order', 'calla' ),
|
||||
'options' => calla_elated_get_query_order_array()
|
||||
),
|
||||
array(
|
||||
'type' => 'textfield',
|
||||
'name' => 'category',
|
||||
'title' => esc_html__( 'Category Slug', 'calla' ),
|
||||
'description' => esc_html__( 'Leave empty for all or use comma for list', 'calla' )
|
||||
),
|
||||
array(
|
||||
'type' => 'dropdown',
|
||||
'name' => 'title_tag',
|
||||
'title' => esc_html__( 'Title Tag', 'calla' ),
|
||||
'options' => calla_elated_get_title_tag( true )
|
||||
),
|
||||
array(
|
||||
'type' => 'dropdown',
|
||||
'name' => 'title_transform',
|
||||
'title' => esc_html__( 'Title Text Transform', 'calla' ),
|
||||
'options' => calla_elated_get_text_transform_array( true )
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
public function widget( $args, $instance ) {
|
||||
if ( ! is_array( $instance ) ) {
|
||||
$instance = array();
|
||||
}
|
||||
|
||||
$instance['image_size'] = 'thumbnail';
|
||||
$instance['post_info_section'] = 'yes';
|
||||
$instance['number_of_columns'] = '1';
|
||||
|
||||
// Filter out all empty params
|
||||
$instance = array_filter( $instance, function ( $array_value ) {
|
||||
return trim( $array_value ) != '';
|
||||
} );
|
||||
$instance['type'] = ! empty( $instance['type'] ) ? $instance['type'] : 'simple';
|
||||
|
||||
$params = '';
|
||||
//generate shortcode params
|
||||
foreach ( $instance as $key => $value ) {
|
||||
$params .= " $key='$value' ";
|
||||
}
|
||||
|
||||
echo '<div class="widget eltdf-blog-list-widget">';
|
||||
if ( ! empty( $instance['widget_title'] ) ) {
|
||||
echo wp_kses_post( $args['before_title'] ) . esc_html( $instance['widget_title'] ) . wp_kses_post( $args['after_title'] );
|
||||
}
|
||||
|
||||
echo do_shortcode( "[eltdf_blog_list $params]" ); // XSS OK
|
||||
echo '</div>';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
if ( ! function_exists( 'calla_elated_register_blog_list_widget' ) ) {
|
||||
/**
|
||||
* Function that register blog list widget
|
||||
*/
|
||||
function calla_elated_register_blog_list_widget( $widgets ) {
|
||||
$widgets[] = 'CallaElatedBlogListWidget';
|
||||
|
||||
return $widgets;
|
||||
}
|
||||
|
||||
add_filter( 'calla_core_register_widgets', 'calla_elated_register_blog_list_widget' );
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
|
||||
include_once ELATED_FRAMEWORK_MODULES_ROOT_DIR . '/widgets/blog-list-widget/functions.php';
|
||||
include_once ELATED_FRAMEWORK_MODULES_ROOT_DIR . '/widgets/blog-list-widget/blog-list.php';
|
||||
@@ -0,0 +1,124 @@
|
||||
<?php
|
||||
|
||||
class CallaElatedButtonWidget extends CallaElatedWidget {
|
||||
public function __construct() {
|
||||
parent::__construct(
|
||||
'eltdf_button_widget',
|
||||
esc_html__( 'Elated Button Widget', 'calla' ),
|
||||
array( 'description' => esc_html__( 'Add button element to widget areas', 'calla' ) )
|
||||
);
|
||||
|
||||
$this->setParams();
|
||||
}
|
||||
|
||||
protected function setParams() {
|
||||
$this->params = array(
|
||||
array(
|
||||
'type' => 'dropdown',
|
||||
'name' => 'type',
|
||||
'title' => esc_html__( 'Type', 'calla' ),
|
||||
'options' => array(
|
||||
'solid' => esc_html__( 'Solid', 'calla' ),
|
||||
'outline' => esc_html__( 'Outline', 'calla' ),
|
||||
'simple' => esc_html__( 'Simple', 'calla' )
|
||||
)
|
||||
),
|
||||
array(
|
||||
'type' => 'dropdown',
|
||||
'name' => 'size',
|
||||
'title' => esc_html__( 'Size', 'calla' ),
|
||||
'options' => array(
|
||||
'small' => esc_html__( 'Small', 'calla' ),
|
||||
'medium' => esc_html__( 'Medium', 'calla' ),
|
||||
'large' => esc_html__( 'Large', 'calla' ),
|
||||
'huge' => esc_html__( 'Huge', 'calla' )
|
||||
),
|
||||
'description' => esc_html__( 'This option is only available for solid and outline button type', 'calla' )
|
||||
),
|
||||
array(
|
||||
'type' => 'textfield',
|
||||
'name' => 'text',
|
||||
'title' => esc_html__( 'Text', 'calla' ),
|
||||
'default' => esc_html__( 'Button Text', 'calla' )
|
||||
),
|
||||
array(
|
||||
'type' => 'textfield',
|
||||
'name' => 'link',
|
||||
'title' => esc_html__( 'Link', 'calla' )
|
||||
),
|
||||
array(
|
||||
'type' => 'dropdown',
|
||||
'name' => 'target',
|
||||
'title' => esc_html__( 'Link Target', 'calla' ),
|
||||
'options' => calla_elated_get_link_target_array()
|
||||
),
|
||||
array(
|
||||
'type' => 'colorpicker',
|
||||
'name' => 'color',
|
||||
'title' => esc_html__( 'Color', 'calla' )
|
||||
),
|
||||
array(
|
||||
'type' => 'colorpicker',
|
||||
'name' => 'hover_color',
|
||||
'title' => esc_html__( 'Hover Color', 'calla' )
|
||||
),
|
||||
array(
|
||||
'type' => 'colorpicker',
|
||||
'name' => 'background_color',
|
||||
'title' => esc_html__( 'Background Color', 'calla' ),
|
||||
'description' => esc_html__( 'This option is only available for solid button type', 'calla' )
|
||||
),
|
||||
array(
|
||||
'type' => 'colorpicker',
|
||||
'name' => 'hover_background_color',
|
||||
'title' => esc_html__( 'Hover Background Color', 'calla' ),
|
||||
'description' => esc_html__( 'This option is only available for solid button type', 'calla' )
|
||||
),
|
||||
array(
|
||||
'type' => 'colorpicker',
|
||||
'name' => 'border_color',
|
||||
'title' => esc_html__( 'Border Color', 'calla' ),
|
||||
'description' => esc_html__( 'This option is only available for solid and outline button type', 'calla' )
|
||||
),
|
||||
array(
|
||||
'type' => 'colorpicker',
|
||||
'name' => 'hover_border_color',
|
||||
'title' => esc_html__( 'Hover Border Color', 'calla' ),
|
||||
'description' => esc_html__( 'This option is only available for solid and outline button type', 'calla' )
|
||||
),
|
||||
array(
|
||||
'type' => 'textfield',
|
||||
'name' => 'margin',
|
||||
'title' => esc_html__( 'Margin', 'calla' ),
|
||||
'description' => esc_html__( 'Insert margin in format: top right bottom left (e.g. 10px 5px 10px 5px)', 'calla' )
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public function widget( $args, $instance ) {
|
||||
$params = '';
|
||||
|
||||
if ( ! is_array( $instance ) ) {
|
||||
$instance = array();
|
||||
}
|
||||
|
||||
// Filter out all empty params
|
||||
$instance = array_filter( $instance, function ( $array_value ) {
|
||||
return trim( $array_value ) != '';
|
||||
} );
|
||||
|
||||
// Default values
|
||||
if ( ! isset( $instance['text'] ) ) {
|
||||
$instance['text'] = 'Button Text';
|
||||
}
|
||||
|
||||
// Generate shortcode params
|
||||
foreach ( $instance as $key => $value ) {
|
||||
$params .= " $key='$value' ";
|
||||
}
|
||||
|
||||
echo '<div class="widget eltdf-button-widget">';
|
||||
echo do_shortcode( "[eltdf_button $params]" ); // XSS OK
|
||||
echo '</div>';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
if ( ! function_exists( 'calla_elated_register_button_widget' ) ) {
|
||||
/**
|
||||
* Function that register button widget
|
||||
*/
|
||||
function calla_elated_register_button_widget( $widgets ) {
|
||||
$widgets[] = 'CallaElatedButtonWidget';
|
||||
|
||||
return $widgets;
|
||||
}
|
||||
|
||||
add_filter( 'calla_core_register_widgets', 'calla_elated_register_button_widget' );
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
|
||||
include_once ELATED_FRAMEWORK_MODULES_ROOT_DIR . '/widgets/button-widget/functions.php';
|
||||
include_once ELATED_FRAMEWORK_MODULES_ROOT_DIR . '/widgets/button-widget/button.php';
|
||||
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
class CallaElatedContactForm7Widget extends CallaElatedWidget {
|
||||
public function __construct() {
|
||||
parent::__construct(
|
||||
'eltdf_contact_form_7_widget',
|
||||
esc_html__( 'Elated Contact Form 7 Widget', 'calla' ),
|
||||
array( 'description' => esc_html__( 'Add contact form 7 to widget areas', 'calla' ) )
|
||||
);
|
||||
|
||||
$this->setParams();
|
||||
}
|
||||
|
||||
protected function setParams() {
|
||||
$cf7 = get_posts( 'post_type="wpcf7_contact_form"&numberposts=-1' );
|
||||
|
||||
$contact_forms = array();
|
||||
if ( $cf7 ) {
|
||||
foreach ( $cf7 as $cform ) {
|
||||
$contact_forms[ $cform->ID ] = $cform->post_title;
|
||||
}
|
||||
} else {
|
||||
$contact_forms[0] = esc_html__( 'No contact forms found', 'calla' );
|
||||
}
|
||||
|
||||
$this->params = array(
|
||||
array(
|
||||
'type' => 'textfield',
|
||||
'name' => 'extra_class',
|
||||
'title' => esc_html__( 'Extra Class Name', 'calla' )
|
||||
),
|
||||
array(
|
||||
'type' => 'textfield',
|
||||
'name' => 'widget_title',
|
||||
'title' => esc_html__( 'Widget Title', 'calla' )
|
||||
),
|
||||
array(
|
||||
'type' => 'dropdown',
|
||||
'name' => 'contact_form',
|
||||
'title' => esc_html__( 'Select Contact Form 7', 'calla' ),
|
||||
'options' => $contact_forms
|
||||
),
|
||||
array(
|
||||
'type' => 'dropdown',
|
||||
'name' => 'contact_form_style',
|
||||
'title' => esc_html__( 'Contact Form 7 Style', 'calla' ),
|
||||
'options' => array(
|
||||
'' => esc_html__( 'Default', 'calla' ),
|
||||
'cf7_custom_style_1' => esc_html__( 'Custom Style 1', 'calla' ),
|
||||
'cf7_custom_style_2' => esc_html__( 'Custom Style 2', 'calla' ),
|
||||
'cf7_custom_style_3' => esc_html__( 'Custom Style 3', 'calla' )
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public function widget( $args, $instance ) {
|
||||
$extra_class = ! empty( $instance['extra_class'] ) ? esc_attr( $instance['extra_class'] ) : '';
|
||||
?>
|
||||
<div class="widget eltdf-contact-form-7-widget <?php echo esc_attr( $extra_class ); ?>">
|
||||
<?php if ( ! empty( $instance['widget_title'] ) ) {
|
||||
echo wp_kses_post( $args['before_title'] ) . esc_html( $instance['widget_title'] ) . wp_kses_post( $args['after_title'] );
|
||||
} ?>
|
||||
<?php if ( ! empty( $instance['contact_form'] ) ) {
|
||||
echo do_shortcode( '[contact-form-7 id="' . esc_attr( $instance['contact_form'] ) . '" html_class="' . esc_attr( $instance['contact_form_style'] ) . '"]' );
|
||||
} ?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
if ( calla_elated_contact_form_7_installed() ) {
|
||||
include_once ELATED_FRAMEWORK_MODULES_ROOT_DIR . '/widgets/contact-form-7/contact-form-7.php';
|
||||
|
||||
add_filter( 'calla_core_register_widgets', 'calla_elated_register_cf7_widget' );
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'calla_elated_register_cf7_widget' ) ) {
|
||||
/**
|
||||
* Function that register cf7 widget
|
||||
*/
|
||||
function calla_elated_register_cf7_widget( $widgets ) {
|
||||
$widgets[] = 'CallaElatedContactForm7Widget';
|
||||
|
||||
return $widgets;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,164 @@
|
||||
<?php
|
||||
|
||||
class CallaElatedCustomFontWidget extends CallaElatedWidget {
|
||||
public function __construct() {
|
||||
parent::__construct(
|
||||
'eltdf_custom_font_widget',
|
||||
esc_html__( 'Elated Custom Font Widget', 'calla' ),
|
||||
array( 'description' => esc_html__( 'Add custom font element to widget areas', 'calla' ) )
|
||||
);
|
||||
|
||||
$this->setParams();
|
||||
}
|
||||
|
||||
protected function setParams() {
|
||||
$this->params = array(
|
||||
array(
|
||||
'type' => 'textfield',
|
||||
'name' => 'custom_class',
|
||||
'title' => esc_html__( 'Custom CSS Class', 'calla' ),
|
||||
'description' => esc_html__( 'Style particular content element differently - add a class name and refer to it in custom CSS', 'calla' )
|
||||
),
|
||||
array(
|
||||
'type' => 'textfield',
|
||||
'name' => 'title',
|
||||
'title' => esc_html__( 'Title Text', 'calla' )
|
||||
),
|
||||
array(
|
||||
'type' => 'dropdown',
|
||||
'name' => 'title_tag',
|
||||
'title' => esc_html__( 'Title Tag', 'calla' ),
|
||||
'options' => calla_elated_get_title_tag( true, array( 'p' => 'p' ) )
|
||||
),
|
||||
array(
|
||||
'type' => 'textfield',
|
||||
'name' => 'font_family',
|
||||
'title' => esc_html__( 'Font Family', 'calla' )
|
||||
),
|
||||
array(
|
||||
'type' => 'textfield',
|
||||
'name' => 'font_size',
|
||||
'title' => esc_html__( 'Font Size (px or em)', 'calla' )
|
||||
),
|
||||
array(
|
||||
'type' => 'textfield',
|
||||
'name' => 'line_height',
|
||||
'title' => esc_html__( 'Line Height (px or em)', 'calla' )
|
||||
),
|
||||
array(
|
||||
'type' => 'dropdown',
|
||||
'name' => 'font_weight',
|
||||
'title' => esc_html__( 'Font Weight', 'calla' ),
|
||||
'options' => calla_elated_get_font_weight_array( true )
|
||||
),
|
||||
array(
|
||||
'type' => 'dropdown',
|
||||
'name' => 'font_style',
|
||||
'title' => esc_html__( 'Font Style', 'calla' ),
|
||||
'options' => calla_elated_get_font_style_array( true )
|
||||
),
|
||||
array(
|
||||
'type' => 'textfield',
|
||||
'name' => 'letter_spacing',
|
||||
'title' => esc_html__( 'Letter Spacing (px or em)', 'calla' )
|
||||
),
|
||||
array(
|
||||
'type' => 'dropdown',
|
||||
'name' => 'text_transform',
|
||||
'title' => esc_html__( 'Text Transform', 'calla' ),
|
||||
'options' => calla_elated_get_text_transform_array( true )
|
||||
),
|
||||
array(
|
||||
'type' => 'dropdown',
|
||||
'name' => 'text_decoration',
|
||||
'title' => esc_html__( 'Text Decoration', 'calla' ),
|
||||
'options' => calla_elated_get_text_decorations( true )
|
||||
),
|
||||
array(
|
||||
'type' => 'colorpicker',
|
||||
'name' => 'color',
|
||||
'title' => esc_html__( 'Color', 'calla' )
|
||||
),
|
||||
array(
|
||||
'type' => 'dropdown',
|
||||
'name' => 'text_align',
|
||||
'title' => esc_html__( 'Text Align', 'calla' ),
|
||||
'options' => array(
|
||||
'' => esc_html__( 'Default', 'calla' ),
|
||||
'left' => esc_html__( 'Left', 'calla' ),
|
||||
'center' => esc_html__( 'Center', 'calla' ),
|
||||
'right' => esc_html__( 'Right', 'calla' ),
|
||||
'justify' => esc_html__( 'Justify', 'calla' )
|
||||
)
|
||||
),
|
||||
array(
|
||||
'type' => 'textfield',
|
||||
'name' => 'margin',
|
||||
'title' => esc_html__( 'Margin (px or %)', 'calla' ),
|
||||
'description' => esc_html__( 'Insert margin in format: top right bottom left (e.g. 10px 5px 10px 5px)', 'calla' )
|
||||
),
|
||||
array(
|
||||
'type' => 'textfield',
|
||||
'name' => 'font_size_1280',
|
||||
'title' => esc_html__( 'Small Laptops Font Size (px or em)', 'calla' )
|
||||
),
|
||||
array(
|
||||
'type' => 'textfield',
|
||||
'name' => 'line_height_1280',
|
||||
'title' => esc_html__( 'Small Laptops Line Height (px or em)', 'calla' )
|
||||
),
|
||||
array(
|
||||
'type' => 'textfield',
|
||||
'name' => 'font_size_1024',
|
||||
'title' => esc_html__( 'Tablets Landscape Font Size (px or em)', 'calla' )
|
||||
),
|
||||
array(
|
||||
'type' => 'textfield',
|
||||
'name' => 'line_height_1024',
|
||||
'title' => esc_html__( 'Tablets Landscape Line Height (px or em)', 'calla' )
|
||||
),
|
||||
array(
|
||||
'type' => 'textfield',
|
||||
'name' => 'font_size_768',
|
||||
'title' => esc_html__( 'Tablets Portrait Font Size (px or em)', 'calla' )
|
||||
),
|
||||
array(
|
||||
'type' => 'textfield',
|
||||
'name' => 'line_height_768',
|
||||
'title' => esc_html__( 'Tablets Portrait Line Height (px or em)', 'calla' )
|
||||
),
|
||||
array(
|
||||
'type' => 'textfield',
|
||||
'name' => 'font_size_680',
|
||||
'title' => esc_html__( 'Mobiles Font Size (px or em)', 'calla' )
|
||||
),
|
||||
array(
|
||||
'type' => 'textfield',
|
||||
'name' => 'line_height_680',
|
||||
'title' => esc_html__( 'Mobiles Line Height (px or em)', 'calla' )
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public function widget( $args, $instance ) {
|
||||
$params = '';
|
||||
|
||||
if ( ! is_array( $instance ) ) {
|
||||
$instance = array();
|
||||
}
|
||||
|
||||
// Filter out all empty params
|
||||
$instance = array_filter( $instance, function ( $array_value ) {
|
||||
return trim( $array_value ) != '';
|
||||
} );
|
||||
|
||||
// Generate shortcode params
|
||||
foreach ( $instance as $key => $value ) {
|
||||
$params .= " $key='$value' ";
|
||||
}
|
||||
|
||||
echo '<div class="widget eltdf-custom-font-widget">';
|
||||
echo do_shortcode( "[eltdf_custom_font $params]" ); // XSS OK
|
||||
echo '</div>';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
if ( ! function_exists( 'calla_elated_register_custom_font_widget' ) ) {
|
||||
/**
|
||||
* Function that register custom font widget
|
||||
*/
|
||||
function calla_elated_register_custom_font_widget( $widgets ) {
|
||||
$widgets[] = 'CallaElatedCustomFontWidget';
|
||||
|
||||
return $widgets;
|
||||
}
|
||||
|
||||
add_filter( 'calla_core_register_widgets', 'calla_elated_register_custom_font_widget' );
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
|
||||
include_once ELATED_FRAMEWORK_MODULES_ROOT_DIR . '/widgets/custom-font/functions.php';
|
||||
include_once ELATED_FRAMEWORK_MODULES_ROOT_DIR . '/widgets/custom-font/custom-font.php';
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
if ( ! function_exists( 'calla_elated_register_icon_widget' ) ) {
|
||||
/**
|
||||
* Function that register icon widget
|
||||
*/
|
||||
function calla_elated_register_icon_widget( $widgets ) {
|
||||
$widgets[] = 'CallaElatedIconWidget';
|
||||
|
||||
return $widgets;
|
||||
}
|
||||
|
||||
add_filter( 'calla_core_register_widgets', 'calla_elated_register_icon_widget' );
|
||||
}
|
||||
128
wp-content/themes/calla/framework/modules/widgets/icon/icon.php
Normal file
128
wp-content/themes/calla/framework/modules/widgets/icon/icon.php
Normal file
@@ -0,0 +1,128 @@
|
||||
<?php
|
||||
|
||||
class CallaElatedIconWidget extends CallaElatedWidget {
|
||||
public function __construct() {
|
||||
parent::__construct(
|
||||
'eltdf_icon_widget',
|
||||
esc_html__( 'Elated Icon Widget', 'calla' ),
|
||||
array( 'description' => esc_html__( 'Add icons to widget areas', 'calla' ) )
|
||||
);
|
||||
|
||||
$this->setParams();
|
||||
}
|
||||
|
||||
protected function setParams() {
|
||||
$this->params = array_merge(
|
||||
calla_elated_icon_collections()->getIconWidgetParamsArray(),
|
||||
array(
|
||||
array(
|
||||
'type' => 'textfield',
|
||||
'name' => 'icon_text',
|
||||
'title' => esc_html__( 'Icon Text', 'calla' )
|
||||
),
|
||||
array(
|
||||
'type' => 'textfield',
|
||||
'name' => 'link',
|
||||
'title' => esc_html__( 'Link', 'calla' )
|
||||
),
|
||||
array(
|
||||
'type' => 'dropdown',
|
||||
'name' => 'target',
|
||||
'title' => esc_html__( 'Target', 'calla' ),
|
||||
'options' => calla_elated_get_link_target_array()
|
||||
),
|
||||
array(
|
||||
'type' => 'textfield',
|
||||
'name' => 'icon_size',
|
||||
'title' => esc_html__( 'Icon Size (px)', 'calla' )
|
||||
),
|
||||
array(
|
||||
'type' => 'colorpicker',
|
||||
'name' => 'icon_color',
|
||||
'title' => esc_html__( 'Icon Color', 'calla' )
|
||||
),
|
||||
array(
|
||||
'type' => 'colorpicker',
|
||||
'name' => 'icon_hover_color',
|
||||
'title' => esc_html__( 'Icon Hover Color', 'calla' )
|
||||
),
|
||||
array(
|
||||
'type' => 'textfield',
|
||||
'name' => 'icon_margin',
|
||||
'title' => esc_html__( 'Icon Margin', 'calla' ),
|
||||
'description' => esc_html__( 'Insert margin in format: top right bottom left (e.g. 10px 5px 10px 5px)', 'calla' )
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public function widget( $args, $instance ) {
|
||||
$holder_classes = array( 'eltdf-icon-widget-holder' );
|
||||
if ( ! empty( $instance['icon_hover_color'] ) ) {
|
||||
$holder_classes[] = 'eltdf-icon-has-hover';
|
||||
}
|
||||
|
||||
$data = array();
|
||||
$data[] = ! empty( $instance['icon_hover_color'] ) ? calla_elated_get_inline_attr( $instance['icon_hover_color'], 'data-hover-color' ) : '';
|
||||
$data = implode( ' ', $data );
|
||||
|
||||
$holder_styles = array();
|
||||
if ( ! empty( $instance['icon_color'] ) ) {
|
||||
$holder_styles[] = 'color: ' . $instance['icon_color'];
|
||||
}
|
||||
|
||||
if ( ! empty( $instance['icon_size'] ) ) {
|
||||
$holder_styles[] = 'font-size: ' . calla_elated_filter_px( $instance['icon_size'] ) . 'px';
|
||||
}
|
||||
|
||||
if ( $instance['icon_margin'] !== '' ) {
|
||||
$holder_styles[] = 'margin: ' . $instance['icon_margin'];
|
||||
}
|
||||
|
||||
$link = ! empty( $instance['link'] ) ? $instance['link'] : '#';
|
||||
$target = ! empty( $instance['target'] ) ? $instance['target'] : '_self';
|
||||
|
||||
$icon_holder_html = '';
|
||||
if ( ! empty( $instance['icon_pack'] ) ) {
|
||||
$icon_class = array();
|
||||
$icon_class[] = ! empty( $instance['fa_icon'] ) && $instance['icon_pack'] === 'font_awesome' ? 'fa ' . $instance['fa_icon'] : '';
|
||||
$icon_class[] = ! empty( $instance['fe_icon'] ) && $instance['icon_pack'] === 'font_elegant' ? $instance['fe_icon'] : '';
|
||||
$icon_class[] = ! empty( $instance['ion_icon'] ) && $instance['icon_pack'] === 'ion_icons' ? $instance['ion_icon'] : '';
|
||||
$icon_class[] = ! empty( $instance['linea_icon'] ) && $instance['icon_pack'] === 'linea_icons' ? $instance['linea_icon'] : '';
|
||||
$icon_class[] = ! empty( $instance['linear_icon'] ) && $instance['icon_pack'] === 'linear_icons' ? 'lnr ' . $instance['linear_icon'] : '';
|
||||
$icon_class[] = ! empty( $instance['simple_line_icon'] ) && $instance['icon_pack'] === 'simple_line_icons' ? $instance['simple_line_icon'] : '';
|
||||
$icon_class[] = ! empty( $instance['dripicon'] ) && $instance['icon_pack'] === 'dripicons' ? $instance['dripicon'] : '';
|
||||
|
||||
$icon_class = array_filter( $icon_class, function ( $value ) {
|
||||
return $value !== '';
|
||||
} );
|
||||
|
||||
if ( ! empty( $icon_class ) ) {
|
||||
$icon_class = implode( ' ', $icon_class );
|
||||
|
||||
$icon_holder_html = '<span class="eltdf-icon-element ' . esc_attr( $icon_class ) . '"></span>';
|
||||
}
|
||||
}
|
||||
|
||||
$icon_text_html = '';
|
||||
$icon_text_class = ! empty( $icon_holder_html ) ? '' : 'eltdf-no-icon';
|
||||
if ( ! empty( $instance['icon_text'] ) ) {
|
||||
$icon_text_html = '<span class="eltdf-icon-text ' . esc_attr( $icon_text_class ) . '">' . esc_html( $instance['icon_text'] ) . '</span>';
|
||||
}
|
||||
?>
|
||||
|
||||
<a <?php calla_elated_class_attribute( $holder_classes ); ?> <?php echo wp_kses_post( $data ); ?> href="<?php echo esc_url( $link ); ?>" target="<?php echo esc_attr( $target ); ?>" <?php echo calla_elated_get_inline_style( $holder_styles ); ?>>
|
||||
<?php echo wp_kses( $icon_holder_html, array(
|
||||
'span' => array(
|
||||
'class' => true
|
||||
)
|
||||
) ); ?>
|
||||
<?php echo wp_kses( $icon_text_html, array(
|
||||
'span' => array(
|
||||
'class' => true
|
||||
)
|
||||
) ); ?>
|
||||
</a>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
|
||||
include_once ELATED_FRAMEWORK_MODULES_ROOT_DIR . '/widgets/icon/functions.php';
|
||||
include_once ELATED_FRAMEWORK_MODULES_ROOT_DIR . '/widgets/icon/icon.php';
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
if ( ! function_exists( 'calla_elated_register_image_gallery_widget' ) ) {
|
||||
/**
|
||||
* Function that register image gallery widget
|
||||
*/
|
||||
function calla_elated_register_image_gallery_widget( $widgets ) {
|
||||
$widgets[] = 'CallaElatedImageGalleryWidget';
|
||||
|
||||
return $widgets;
|
||||
}
|
||||
|
||||
add_filter( 'calla_core_register_widgets', 'calla_elated_register_image_gallery_widget' );
|
||||
}
|
||||
@@ -0,0 +1,140 @@
|
||||
<?php
|
||||
|
||||
class CallaElatedImageGalleryWidget extends CallaElatedWidget {
|
||||
public function __construct() {
|
||||
parent::__construct(
|
||||
'eltdf_image_gallery_widget',
|
||||
esc_html__( 'Elated Image Gallery Widget', 'calla' ),
|
||||
array( 'description' => esc_html__( 'Add image gallery element to widget areas', 'calla' ) )
|
||||
);
|
||||
|
||||
$this->setParams();
|
||||
}
|
||||
|
||||
protected function setParams() {
|
||||
$this->params = array(
|
||||
array(
|
||||
'type' => 'textfield',
|
||||
'name' => 'extra_class',
|
||||
'title' => esc_html__( 'Custom CSS Class', 'calla' )
|
||||
),
|
||||
array(
|
||||
'type' => 'textfield',
|
||||
'name' => 'widget_title',
|
||||
'title' => esc_html__( 'Widget Title', 'calla' )
|
||||
),
|
||||
array(
|
||||
'type' => 'dropdown',
|
||||
'name' => 'type',
|
||||
'title' => esc_html__( 'Gallery Type', 'calla' ),
|
||||
'options' => array(
|
||||
'grid' => esc_html__( 'Image Grid', 'calla' ),
|
||||
'slider' => esc_html__( 'Slider', 'calla' )
|
||||
)
|
||||
),
|
||||
array(
|
||||
'type' => 'textfield',
|
||||
'name' => 'images',
|
||||
'title' => esc_html__( 'Image ID\'s', 'calla' ),
|
||||
'description' => esc_html__( 'Add images id for your image gallery widget, separate id\'s with comma', 'calla' )
|
||||
),
|
||||
array(
|
||||
'type' => 'textfield',
|
||||
'name' => 'image_size',
|
||||
'title' => esc_html__( 'Image Size', 'calla' ),
|
||||
'description' => esc_html__( 'Enter image size. Example: thumbnail, medium, large, full or other sizes defined by current theme. Alternatively enter image size in pixels: 200x100 (Width x Height). Leave empty to use "thumbnail" size', 'calla' )
|
||||
),
|
||||
array(
|
||||
'type' => 'dropdown',
|
||||
'name' => 'enable_image_shadow',
|
||||
'title' => esc_html__( 'Enable Image Shadow', 'calla' ),
|
||||
'options' => calla_elated_get_yes_no_select_array()
|
||||
),
|
||||
array(
|
||||
'type' => 'dropdown',
|
||||
'name' => 'image_behavior',
|
||||
'title' => esc_html__( 'Image Behavior', 'calla' ),
|
||||
'options' => array(
|
||||
'' => esc_html__( 'None', 'calla' ),
|
||||
'lightbox' => esc_html__( 'Open Lightbox', 'calla' ),
|
||||
'custom-link' => esc_html__( 'Open Custom Link', 'calla' ),
|
||||
'zoom' => esc_html__( 'Zoom', 'calla' ),
|
||||
'grayscale' => esc_html__( 'Grayscale', 'calla' )
|
||||
)
|
||||
),
|
||||
array(
|
||||
'type' => 'textarea',
|
||||
'name' => 'custom_links',
|
||||
'title' => esc_html__( 'Custom Links', 'calla' ),
|
||||
'description' => esc_html__( 'Delimit links by comma', 'calla' )
|
||||
),
|
||||
array(
|
||||
'type' => 'dropdown',
|
||||
'name' => 'custom_link_target',
|
||||
'title' => esc_html__( 'Custom Link Target', 'calla' ),
|
||||
'options' => calla_elated_get_link_target_array()
|
||||
),
|
||||
array(
|
||||
'type' => 'dropdown',
|
||||
'name' => 'number_of_columns',
|
||||
'title' => esc_html__( 'Number of Columns', 'calla' ),
|
||||
'options' => array(
|
||||
'two' => esc_html__( 'Two', 'calla' ),
|
||||
'three' => esc_html__( 'Three', 'calla' ),
|
||||
'four' => esc_html__( 'Four', 'calla' ),
|
||||
'five' => esc_html__( 'Five', 'calla' ),
|
||||
'six' => esc_html__( 'Six', 'calla' )
|
||||
)
|
||||
),
|
||||
array(
|
||||
'type' => 'dropdown',
|
||||
'name' => 'space_between_columns',
|
||||
'title' => esc_html__( 'Space Between Items', 'calla' ),
|
||||
'options' => calla_elated_get_space_between_items_array()
|
||||
),
|
||||
array(
|
||||
'type' => 'dropdown',
|
||||
'name' => 'slider_navigation',
|
||||
'title' => esc_html__( 'Enable Slider Navigation Arrows', 'calla' ),
|
||||
'options' => calla_elated_get_yes_no_select_array( false )
|
||||
),
|
||||
array(
|
||||
'type' => 'dropdown',
|
||||
'name' => 'slider_pagination',
|
||||
'title' => esc_html__( 'Enable Slider Pagination', 'calla' ),
|
||||
'options' => calla_elated_get_yes_no_select_array( false )
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public function widget( $args, $instance ) {
|
||||
if ( ! is_array( $instance ) ) {
|
||||
$instance = array();
|
||||
}
|
||||
|
||||
$extra_class = ! empty( $instance['extra_class'] ) ? $instance['extra_class'] : '';
|
||||
$instance['type'] = ! empty( $instance['type'] ) ? $instance['type'] : 'grid';
|
||||
|
||||
//prepare variables
|
||||
$params = '';
|
||||
|
||||
//is instance empty?
|
||||
if ( is_array( $instance ) && count( $instance ) ) {
|
||||
//generate shortcode params
|
||||
foreach ( $instance as $key => $value ) {
|
||||
$params .= " $key='$value' ";
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<div class="widget eltdf-image-gallery-widget <?php echo esc_attr( $extra_class ); ?>">
|
||||
<?php
|
||||
if ( ! empty( $instance['widget_title'] ) ) {
|
||||
echo wp_kses_post( $args['before_title'] ) . esc_html( $instance['widget_title'] ) . wp_kses_post( $args['after_title'] );
|
||||
}
|
||||
echo do_shortcode( "[eltdf_image_gallery $params]" ); // XSS OK
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
|
||||
include_once ELATED_FRAMEWORK_MODULES_ROOT_DIR . '/widgets/image-gallery/functions.php';
|
||||
include_once ELATED_FRAMEWORK_MODULES_ROOT_DIR . '/widgets/image-gallery/image-gallery.php';
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
if ( ! function_exists( 'calla_elated_register_recent_posts_widget' ) ) {
|
||||
/**
|
||||
* Function that register search opener widget
|
||||
*/
|
||||
function calla_elated_register_recent_posts_widget( $widgets ) {
|
||||
$widgets[] = 'CallaElatedRecentPosts';
|
||||
|
||||
return $widgets;
|
||||
}
|
||||
|
||||
add_filter( 'calla_core_register_widgets', 'calla_elated_register_recent_posts_widget' );
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
|
||||
include_once ELATED_FRAMEWORK_MODULES_ROOT_DIR . '/widgets/recent-posts/functions.php';
|
||||
include_once ELATED_FRAMEWORK_MODULES_ROOT_DIR . '/widgets/recent-posts/recent-posts.php';
|
||||
@@ -0,0 +1,93 @@
|
||||
<?php
|
||||
|
||||
class CallaElatedRecentPosts extends CallaElatedWidget {
|
||||
public function __construct() {
|
||||
parent::__construct(
|
||||
'eltdf_recent_posts',
|
||||
esc_html__( 'Elated Recent Posts', 'calla' ),
|
||||
array( 'description' => esc_html__( 'Select recent posts that you would like to display', 'calla' ) )
|
||||
);
|
||||
|
||||
$this->setParams();
|
||||
}
|
||||
|
||||
protected function setParams() {
|
||||
$post_types = apply_filters( 'calla_elated_search_post_type_widget_params_post_type', array( 'post' => esc_html__( 'Post', 'calla' ) ) );
|
||||
|
||||
$this->params = array(
|
||||
array(
|
||||
'type' => 'textfield',
|
||||
'name' => 'widget_title',
|
||||
'title' => esc_html__( 'Widget Title', 'calla' )
|
||||
),
|
||||
array(
|
||||
'type' => 'dropdown',
|
||||
'name' => 'post_type',
|
||||
'title' => esc_html__( 'Post Type', 'calla' ),
|
||||
'description' => esc_html__( 'Choose post type that you want to be searched for', 'calla' ),
|
||||
'options' => $post_types
|
||||
),
|
||||
array(
|
||||
'type' => 'dropdown',
|
||||
'name' => 'title_tag',
|
||||
'title' => esc_html__( 'Title Tag', 'calla' ),
|
||||
'options' => calla_elated_get_title_tag(true, array('p' => 'p'))
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public function widget( $args, $instance ) {
|
||||
|
||||
if ( ! is_array( $instance ) ) {
|
||||
$instance = array();
|
||||
}
|
||||
|
||||
if($instance['post_type'] !== ''){
|
||||
$type = $instance['post_type'];
|
||||
}
|
||||
else{
|
||||
$type = 'post';
|
||||
}
|
||||
|
||||
if(empty($instance['title_tag'])){
|
||||
$instance['title_tag'] = 'h6';
|
||||
}
|
||||
|
||||
$params = array(
|
||||
'post_type' => $type,
|
||||
'post_status' => 'publish',
|
||||
'order' => 'DESC',
|
||||
'orderby' => 'date',
|
||||
'posts_per_page' => 3
|
||||
);
|
||||
|
||||
|
||||
$query = new WP_Query( $params );
|
||||
|
||||
$html = '';
|
||||
$html .= '<div class="widget eltdf-recent-post-widget">';
|
||||
|
||||
if ( ! empty( $instance['widget_title'] ) ) {
|
||||
$html .= wp_kses_post( $args['before_title'] ) . esc_html( $instance['widget_title'] ) . wp_kses_post( $args['after_title'] );
|
||||
}
|
||||
|
||||
if ( $query->have_posts() ) {
|
||||
$html .= '<ul class="eltdf-recent-posts">';
|
||||
while ( $query->have_posts() ) {
|
||||
$query->the_post();
|
||||
$html .= '<li class="eltdf-rp-item"><a href="' . get_the_permalink() . '"><div class="eltdf-rp-image">' . get_the_post_thumbnail(get_the_ID(), 'thumbnail') . '</div><div class="eltdf-recent-posts-info"><'.$instance['title_tag'].' class="eltdf-rp-title">' . get_the_title() . '</'.$instance['title_tag'].'><span class="eltdf-rp-date">'.get_the_date().'</span></div></a></li>';
|
||||
}
|
||||
$html .= '</ul>';
|
||||
}
|
||||
|
||||
else {
|
||||
$html .= esc_html__('Sorry, there are no posts matching your criteria', 'calla');
|
||||
}
|
||||
|
||||
$html .= '</div>';
|
||||
|
||||
wp_reset_postdata();
|
||||
|
||||
echo calla_elated_get_module_part( $html );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
if ( ! function_exists( 'calla_elated_register_search_opener_widget' ) ) {
|
||||
/**
|
||||
* Function that register search opener widget
|
||||
*/
|
||||
function calla_elated_register_search_opener_widget( $widgets ) {
|
||||
$widgets[] = 'CallaElatedSearchOpener';
|
||||
|
||||
return $widgets;
|
||||
}
|
||||
|
||||
add_filter( 'calla_core_register_widgets', 'calla_elated_register_search_opener_widget' );
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
|
||||
include_once ELATED_FRAMEWORK_MODULES_ROOT_DIR . '/widgets/search-opener/functions.php';
|
||||
include_once ELATED_FRAMEWORK_MODULES_ROOT_DIR . '/widgets/search-opener/search-opener.php';
|
||||
@@ -0,0 +1,105 @@
|
||||
<?php
|
||||
|
||||
class CallaElatedSearchOpener extends CallaElatedWidget {
|
||||
public function __construct() {
|
||||
parent::__construct(
|
||||
'eltdf_search_opener',
|
||||
esc_html__( 'Elated Search Opener', 'calla' ),
|
||||
array( 'description' => esc_html__( 'Display a "search" icon that opens the search form', 'calla' ) )
|
||||
);
|
||||
|
||||
$this->setParams();
|
||||
}
|
||||
|
||||
protected function setParams() {
|
||||
|
||||
$search_icon_params = array(
|
||||
array(
|
||||
'type' => 'colorpicker',
|
||||
'name' => 'search_icon_color',
|
||||
'title' => esc_html__( 'Icon Color', 'calla' ),
|
||||
'description' => esc_html__( 'Define color for search icon', 'calla' )
|
||||
),
|
||||
array(
|
||||
'type' => 'colorpicker',
|
||||
'name' => 'search_icon_hover_color',
|
||||
'title' => esc_html__( 'Icon Hover Color', 'calla' ),
|
||||
'description' => esc_html__( 'Define hover color for search icon', 'calla' )
|
||||
),
|
||||
array(
|
||||
'type' => 'textfield',
|
||||
'name' => 'search_icon_margin',
|
||||
'title' => esc_html__( 'Icon Margin', 'calla' ),
|
||||
'description' => esc_html__( 'Insert margin in format: top right bottom left (e.g. 10px 5px 10px 5px)', 'calla' )
|
||||
),
|
||||
array(
|
||||
'type' => 'dropdown',
|
||||
'name' => 'show_label',
|
||||
'title' => esc_html__( 'Enable Search Icon Text', 'calla' ),
|
||||
'description' => esc_html__( 'Enable this option to show search text next to search icon in header', 'calla' ),
|
||||
'options' => calla_elated_get_yes_no_select_array()
|
||||
)
|
||||
);
|
||||
|
||||
$search_icon_pack_params = array(
|
||||
array(
|
||||
'type' => 'textfield',
|
||||
'name' => 'search_icon_size',
|
||||
'title' => esc_html__( 'Icon Size (px)', 'calla' ),
|
||||
'description' => esc_html__( 'Define size for search icon', 'calla' )
|
||||
)
|
||||
);
|
||||
|
||||
if ( calla_elated_options()->getOptionValue( 'search_icon_pack' ) == 'icon_pack' ) {
|
||||
$this->params = array_merge( $search_icon_pack_params, $search_icon_params );
|
||||
} else {
|
||||
$this->params = $search_icon_params;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function widget( $args, $instance ) {
|
||||
global $calla_elated_IconCollections;
|
||||
|
||||
$search_icon_source = calla_elated_options()->getOptionValue( 'search_icon_source' );
|
||||
$search_icon_pack = calla_elated_options()->getOptionValue( 'search_icon_pack' );
|
||||
$search_icon_svg_path = calla_elated_options()->getOptionValue( 'search_icon_svg_path' );
|
||||
$enable_search_icon_text = calla_elated_options()->getOptionValue( 'enable_search_icon_text' );
|
||||
|
||||
$search_icon_class_array = array(
|
||||
'eltdf-search-opener',
|
||||
'eltdf-icon-has-hover'
|
||||
);
|
||||
|
||||
$search_icon_class_array[] = $search_icon_source == 'icon_pack' ? 'eltdf-search-opener-icon-pack' : 'eltdf-search-opener-svg-path';
|
||||
|
||||
$styles = array();
|
||||
$show_search_text = $instance['show_label'] == 'yes' || $enable_search_icon_text == 'yes' ? true : false;
|
||||
|
||||
if ( ! empty( $instance['search_icon_size'] ) ) {
|
||||
$styles[] = 'font-size: ' . intval( $instance['search_icon_size'] ) . 'px';
|
||||
}
|
||||
|
||||
if ( ! empty( $instance['search_icon_color'] ) ) {
|
||||
$styles[] = 'color: ' . $instance['search_icon_color'] . ';';
|
||||
}
|
||||
|
||||
if ( ! empty( $instance['search_icon_margin'] ) ) {
|
||||
$styles[] = 'margin: ' . $instance['search_icon_margin'] . ';';
|
||||
}
|
||||
?>
|
||||
|
||||
<a <?php calla_elated_inline_attr( $instance['search_icon_hover_color'], 'data-hover-color' ); ?> <?php calla_elated_inline_style( $styles ); ?> <?php calla_elated_class_attribute( $search_icon_class_array ); ?> href="javascript:void(0)">
|
||||
<span class="eltdf-search-opener-wrapper">
|
||||
<?php if ( ( $search_icon_source == 'icon_pack' ) && isset( $search_icon_pack ) ) {
|
||||
$calla_elated_IconCollections->getSearchIcon( $search_icon_pack, false );
|
||||
} else if ( ( $search_icon_source == 'svg_path' ) && isset( $search_icon_svg_path ) ) {
|
||||
echo calla_elated_get_module_part( $search_icon_svg_path );
|
||||
}?>
|
||||
<?php if ( $show_search_text ) { ?>
|
||||
<span class="eltdf-search-icon-text"><?php esc_html_e( 'Search', 'calla' ); ?></span>
|
||||
<?php } ?>
|
||||
</span>
|
||||
</a>
|
||||
<?php }
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
if ( ! function_exists( 'calla_elated_register_search_post_type_widget' ) ) {
|
||||
/**
|
||||
* Function that register search opener widget
|
||||
*/
|
||||
function calla_elated_register_search_post_type_widget( $widgets ) {
|
||||
$widgets[] = 'CallaElatedSearchPostType';
|
||||
|
||||
return $widgets;
|
||||
}
|
||||
|
||||
add_filter( 'calla_core_register_widgets', 'calla_elated_register_search_post_type_widget' );
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'calla_elated_search_post_types' ) ) {
|
||||
function calla_elated_search_post_types() {
|
||||
$user_id = get_current_user_id();
|
||||
|
||||
if ( empty( $_POST ) || ! isset( $_POST ) ) {
|
||||
calla_elated_ajax_status( 'error', esc_html__( 'All fields are empty', 'calla' ) );
|
||||
} else {
|
||||
$args = array(
|
||||
'post_type' => sanitize_text_field($_POST['postType']),
|
||||
'post_status' => 'publish',
|
||||
'order' => 'DESC',
|
||||
'orderby' => 'date',
|
||||
's' => sanitize_text_field($_POST['term']),
|
||||
'posts_per_page' => 5
|
||||
);
|
||||
|
||||
$html = '';
|
||||
$query = new WP_Query( $args );
|
||||
|
||||
if ( $query->have_posts() ) {
|
||||
$html .= '<ul>';
|
||||
while ( $query->have_posts() ) {
|
||||
$query->the_post();
|
||||
$html .= '<li><a href="' . get_the_permalink() . '">' . get_the_title() . '</a></li>';
|
||||
}
|
||||
$html .= '</ul>';
|
||||
$json_data['html'] = $html;
|
||||
calla_elated_ajax_status( 'success', '', $json_data );
|
||||
} else {
|
||||
$html .= '<ul>';
|
||||
$html .= '<li>' . esc_html__( 'No posts found.', 'calla' ) . '</li>';
|
||||
$html .= '</ul>';
|
||||
$json_data['html'] = $html;
|
||||
calla_elated_ajax_status( 'success', '', $json_data );
|
||||
}
|
||||
}
|
||||
|
||||
wp_die();
|
||||
}
|
||||
|
||||
add_action( 'wp_ajax_calla_elated_search_post_types', 'calla_elated_search_post_types' );
|
||||
add_action( 'wp_ajax_nopriv_calla_elated_search_post_types', 'calla_elated_search_post_types' );
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
|
||||
include_once ELATED_FRAMEWORK_MODULES_ROOT_DIR . '/widgets/search-post-type/functions.php';
|
||||
include_once ELATED_FRAMEWORK_MODULES_ROOT_DIR . '/widgets/search-post-type/search-post-type.php';
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
class CallaElatedSearchPostType extends CallaElatedWidget {
|
||||
public function __construct() {
|
||||
parent::__construct(
|
||||
'eltdf_search_post_type',
|
||||
esc_html__( 'Elated Search Post Type', 'calla' ),
|
||||
array( 'description' => esc_html__( 'Select post type that you want to be searched for', 'calla' ) )
|
||||
);
|
||||
|
||||
$this->setParams();
|
||||
}
|
||||
|
||||
protected function setParams() {
|
||||
$post_types = apply_filters( 'calla_elated_search_post_type_widget_params_post_type', array( 'post' => esc_html__( 'Post', 'calla' ) ) );
|
||||
|
||||
$this->params = array(
|
||||
array(
|
||||
'type' => 'dropdown',
|
||||
'name' => 'post_type',
|
||||
'title' => esc_html__( 'Post Type', 'calla' ),
|
||||
'description' => esc_html__( 'Choose post type that you want to be searched for', 'calla' ),
|
||||
'options' => $post_types
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public function widget( $args, $instance ) {
|
||||
$search_type_class = 'eltdf-search-post-type';
|
||||
$post_type = $instance['post_type'];
|
||||
?>
|
||||
|
||||
<div class="widget eltdf-search-post-type-widget">
|
||||
<div data-post-type="<?php echo esc_attr( $post_type ); ?>" <?php calla_elated_class_attribute( $search_type_class ); ?>>
|
||||
<input class="eltdf-post-type-search-field" value="" placeholder="<?php esc_attr_e( 'Search here', 'calla' ) ?>">
|
||||
<i class="eltdf-search-icon fa fa-search" aria-hidden="true"></i>
|
||||
<i class="eltdf-search-loading fa fa-spinner fa-spin eltdf-hidden" aria-hidden="true"></i>
|
||||
</div>
|
||||
<div class="eltdf-post-type-search-results"></div>
|
||||
</div>
|
||||
<?php }
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
if ( ! function_exists( 'calla_elated_register_separator_widget' ) ) {
|
||||
/**
|
||||
* Function that register separator widget
|
||||
*/
|
||||
function calla_elated_register_separator_widget( $widgets ) {
|
||||
$widgets[] = 'CallaElatedSeparatorWidget';
|
||||
|
||||
return $widgets;
|
||||
}
|
||||
|
||||
add_filter( 'calla_core_register_widgets', 'calla_elated_register_separator_widget' );
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
|
||||
include_once ELATED_FRAMEWORK_MODULES_ROOT_DIR . '/widgets/separator/functions.php';
|
||||
include_once ELATED_FRAMEWORK_MODULES_ROOT_DIR . '/widgets/separator/separator.php';
|
||||
@@ -0,0 +1,93 @@
|
||||
<?php
|
||||
|
||||
class CallaElatedSeparatorWidget extends CallaElatedWidget {
|
||||
public function __construct() {
|
||||
parent::__construct(
|
||||
'eltdf_separator_widget',
|
||||
esc_html__( 'Elated Separator Widget', 'calla' ),
|
||||
array( 'description' => esc_html__( 'Add a separator element to your widget areas', 'calla' ) )
|
||||
);
|
||||
|
||||
$this->setParams();
|
||||
}
|
||||
|
||||
protected function setParams() {
|
||||
$this->params = array(
|
||||
array(
|
||||
'type' => 'dropdown',
|
||||
'name' => 'type',
|
||||
'title' => esc_html__( 'Type', 'calla' ),
|
||||
'options' => array(
|
||||
'normal' => esc_html__( 'Normal', 'calla' ),
|
||||
'full-width' => esc_html__( 'Full Width', 'calla' )
|
||||
)
|
||||
),
|
||||
array(
|
||||
'type' => 'dropdown',
|
||||
'name' => 'position',
|
||||
'title' => esc_html__( 'Position', 'calla' ),
|
||||
'options' => array(
|
||||
'center' => esc_html__( 'Center', 'calla' ),
|
||||
'left' => esc_html__( 'Left', 'calla' ),
|
||||
'right' => esc_html__( 'Right', 'calla' )
|
||||
)
|
||||
),
|
||||
array(
|
||||
'type' => 'dropdown',
|
||||
'name' => 'border_style',
|
||||
'title' => esc_html__( 'Style', 'calla' ),
|
||||
'options' => array(
|
||||
'solid' => esc_html__( 'Solid', 'calla' ),
|
||||
'dashed' => esc_html__( 'Dashed', 'calla' ),
|
||||
'dotted' => esc_html__( 'Dotted', 'calla' )
|
||||
)
|
||||
),
|
||||
array(
|
||||
'type' => 'colorpicker',
|
||||
'name' => 'color',
|
||||
'title' => esc_html__( 'Color', 'calla' )
|
||||
),
|
||||
array(
|
||||
'type' => 'textfield',
|
||||
'name' => 'width',
|
||||
'title' => esc_html__( 'Width (px or %)', 'calla' )
|
||||
),
|
||||
array(
|
||||
'type' => 'textfield',
|
||||
'name' => 'thickness',
|
||||
'title' => esc_html__( 'Thickness (px)', 'calla' )
|
||||
),
|
||||
array(
|
||||
'type' => 'textfield',
|
||||
'name' => 'top_margin',
|
||||
'title' => esc_html__( 'Top Margin (px or %)', 'calla' )
|
||||
),
|
||||
array(
|
||||
'type' => 'textfield',
|
||||
'name' => 'bottom_margin',
|
||||
'title' => esc_html__( 'Bottom Margin (px or %)', 'calla' )
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public function widget( $args, $instance ) {
|
||||
if ( ! is_array( $instance ) ) {
|
||||
$instance = array();
|
||||
}
|
||||
|
||||
//prepare variables
|
||||
$params = '';
|
||||
|
||||
//is instance empty?
|
||||
if ( is_array( $instance ) && count( $instance ) ) {
|
||||
//generate shortcode params
|
||||
foreach ( $instance as $key => $value ) {
|
||||
$params .= " $key='$value' ";
|
||||
}
|
||||
}
|
||||
|
||||
echo '<div class="widget eltdf-separator-widget">';
|
||||
echo do_shortcode( "[eltdf_separator $params]" ); // XSS OK
|
||||
echo '</div>';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
if ( ! function_exists( 'calla_elated_register_sidearea_opener_widget' ) ) {
|
||||
/**
|
||||
* Function that register sidearea opener widget
|
||||
*/
|
||||
function calla_elated_register_sidearea_opener_widget( $widgets ) {
|
||||
$widgets[] = 'CallaElatedSideAreaOpener';
|
||||
|
||||
return $widgets;
|
||||
}
|
||||
|
||||
add_filter( 'calla_core_register_widgets', 'calla_elated_register_sidearea_opener_widget' );
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
|
||||
include_once ELATED_FRAMEWORK_MODULES_ROOT_DIR . '/widgets/sidearea-opener/functions.php';
|
||||
include_once ELATED_FRAMEWORK_MODULES_ROOT_DIR . '/widgets/sidearea-opener/side-area-opener.php';
|
||||
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
|
||||
class CallaElatedSideAreaOpener extends CallaElatedWidget {
|
||||
public function __construct() {
|
||||
parent::__construct(
|
||||
'eltdf_side_area_opener',
|
||||
esc_html__( 'Elated Side Area Opener', 'calla' ),
|
||||
array( 'description' => esc_html__( 'Display a "hamburger" icon that opens the side area', 'calla' ) )
|
||||
);
|
||||
|
||||
$this->setParams();
|
||||
}
|
||||
|
||||
protected function setParams() {
|
||||
$this->params = array(
|
||||
array(
|
||||
'type' => 'colorpicker',
|
||||
'name' => 'icon_color',
|
||||
'title' => esc_html__( 'Side Area Opener Color', 'calla' ),
|
||||
'description' => esc_html__( 'Define color for side area opener', 'calla' )
|
||||
),
|
||||
array(
|
||||
'type' => 'colorpicker',
|
||||
'name' => 'icon_hover_color',
|
||||
'title' => esc_html__( 'Side Area Opener Hover Color', 'calla' ),
|
||||
'description' => esc_html__( 'Define hover color for side area opener', 'calla' )
|
||||
),
|
||||
array(
|
||||
'type' => 'textfield',
|
||||
'name' => 'widget_margin',
|
||||
'title' => esc_html__( 'Side Area Opener Margin', 'calla' ),
|
||||
'description' => esc_html__( 'Insert margin in format: top right bottom left (e.g. 10px 5px 10px 5px)', 'calla' )
|
||||
),
|
||||
array(
|
||||
'type' => 'textfield',
|
||||
'name' => 'widget_title',
|
||||
'title' => esc_html__( 'Side Area Opener Title', 'calla' )
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public function widget( $args, $instance ) {
|
||||
|
||||
$side_area_icon_source = calla_elated_options()->getOptionValue( 'side_area_icon_source' );
|
||||
$side_area_icon_pack = calla_elated_options()->getOptionValue( 'side_area_icon_pack' );
|
||||
$side_area_icon_svg_path = calla_elated_options()->getOptionValue( 'side_area_icon_svg_path' );
|
||||
|
||||
$side_area_icon_class_array = array(
|
||||
'eltdf-side-menu-button-opener',
|
||||
'eltdf-icon-has-hover'
|
||||
);
|
||||
|
||||
$side_area_icon_class_array[] = $side_area_icon_source == 'icon_pack' ? 'eltdf-side-menu-button-opener-icon-pack' : 'eltdf-side-menu-button-opener-svg-path';
|
||||
|
||||
$holder_styles = array();
|
||||
|
||||
if ( ! empty( $instance['icon_color'] ) ) {
|
||||
$holder_styles[] = 'color: ' . $instance['icon_color'] . ';';
|
||||
}
|
||||
if ( ! empty( $instance['widget_margin'] ) ) {
|
||||
$holder_styles[] = 'margin: ' . $instance['widget_margin'];
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<a <?php calla_elated_class_attribute( $side_area_icon_class_array ); ?> <?php echo calla_elated_get_inline_attr( $instance['icon_hover_color'], 'data-hover-color' ); ?> href="javascript:void(0)" <?php calla_elated_inline_style( $holder_styles ); ?>>
|
||||
<?php if ( ! empty( $instance['widget_title'] ) ) { ?>
|
||||
<h5 class="eltdf-side-menu-title"><?php echo esc_html( $instance['widget_title'] ); ?></h5>
|
||||
<?php } ?>
|
||||
<span class="eltdf-side-menu-icon">
|
||||
<?php if ( ( $side_area_icon_source == 'icon_pack' ) && isset( $side_area_icon_pack ) ) {
|
||||
echo calla_elated_icon_collections()->getMenuIcon( $side_area_icon_pack );
|
||||
} else if ( isset( $side_area_icon_svg_path ) ) {
|
||||
echo calla_elated_get_module_part( $side_area_icon_svg_path );
|
||||
}?>
|
||||
</span>
|
||||
</a>
|
||||
<?php }
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
if ( ! function_exists( 'calla_elated_register_social_icon_widget' ) ) {
|
||||
/**
|
||||
* Function that register social icon widget
|
||||
*/
|
||||
function calla_elated_register_social_icon_widget( $widgets ) {
|
||||
$widgets[] = 'CallaElatedSocialIconWidget';
|
||||
|
||||
return $widgets;
|
||||
}
|
||||
|
||||
add_filter( 'calla_core_register_widgets', 'calla_elated_register_social_icon_widget' );
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
|
||||
include_once ELATED_FRAMEWORK_MODULES_ROOT_DIR . '/widgets/social-icon/functions.php';
|
||||
include_once ELATED_FRAMEWORK_MODULES_ROOT_DIR . '/widgets/social-icon/social-icon.php';
|
||||
@@ -0,0 +1,95 @@
|
||||
<?php
|
||||
|
||||
class CallaElatedSocialIconWidget extends CallaElatedWidget {
|
||||
|
||||
public function __construct() {
|
||||
parent::__construct(
|
||||
'eltdf_social_icon_widget',
|
||||
esc_html__( 'Elated Social Icon Widget', 'calla' ),
|
||||
array( 'description' => esc_html__( 'Add social network icons to widget areas', 'calla' ) )
|
||||
);
|
||||
|
||||
$this->setParams();
|
||||
}
|
||||
|
||||
protected function setParams() {
|
||||
$this->params = array_merge(
|
||||
calla_elated_icon_collections()->getSocialIconWidgetParamsArray(),
|
||||
array(
|
||||
array(
|
||||
'type' => 'textfield',
|
||||
'name' => 'link',
|
||||
'title' => esc_html__( 'Link', 'calla' )
|
||||
),
|
||||
array(
|
||||
'type' => 'dropdown',
|
||||
'name' => 'target',
|
||||
'title' => esc_html__( 'Target', 'calla' ),
|
||||
'options' => calla_elated_get_link_target_array()
|
||||
),
|
||||
array(
|
||||
'type' => 'textfield',
|
||||
'name' => 'icon_size',
|
||||
'title' => esc_html__( 'Icon Size (px)', 'calla' )
|
||||
),
|
||||
array(
|
||||
'type' => 'colorpicker',
|
||||
'name' => 'color',
|
||||
'title' => esc_html__( 'Color', 'calla' )
|
||||
),
|
||||
array(
|
||||
'type' => 'colorpicker',
|
||||
'name' => 'hover_color',
|
||||
'title' => esc_html__( 'Hover Color', 'calla' )
|
||||
),
|
||||
array(
|
||||
'type' => 'textfield',
|
||||
'name' => 'margin',
|
||||
'title' => esc_html__( 'Margin', 'calla' ),
|
||||
'description' => esc_html__( 'Insert margin in format: top right bottom left (e.g. 10px 5px 10px 5px)', 'calla' )
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public function widget( $args, $instance ) {
|
||||
$icon_styles = array();
|
||||
|
||||
if ( ! empty( $instance['color'] ) ) {
|
||||
$icon_styles[] = 'color: ' . $instance['color'];
|
||||
}
|
||||
|
||||
if ( ! empty( $instance['icon_size'] ) ) {
|
||||
$icon_styles[] = 'font-size: ' . calla_elated_filter_px( $instance['icon_size'] ) . 'px';
|
||||
}
|
||||
|
||||
if ( ! empty( $instance['margin'] ) ) {
|
||||
$icon_styles[] = 'margin: ' . $instance['margin'] . ';';
|
||||
}
|
||||
|
||||
$link = ! empty( $instance['link'] ) ? $instance['link'] : '#';
|
||||
$target = ! empty( $instance['target'] ) ? $instance['target'] : '_self';
|
||||
$hover_color = ! empty( $instance['hover_color'] ) ? $instance['hover_color'] : '';
|
||||
|
||||
$icon_holder_html = '';
|
||||
if ( ! empty( $instance['icon_pack'] ) ) {
|
||||
$icon_class = array( 'eltdf-social-icon-widget' );
|
||||
$icon_class[] = ! empty( $instance['fa_icon'] ) && $instance['icon_pack'] === 'font_awesome' ? 'fa ' . $instance['fa_icon'] : '';
|
||||
$icon_class[] = ! empty( $instance['fe_icon'] ) && $instance['icon_pack'] === 'font_elegant' ? $instance['fe_icon'] : '';
|
||||
$icon_class[] = ! empty( $instance['ion_icon'] ) && $instance['icon_pack'] === 'ion_icons' ? $instance['ion_icon'] : '';
|
||||
$icon_class[] = ! empty( $instance['linea_icon'] ) && $instance['icon_pack'] === 'linea_icons' ? $instance['linea_icon'] : '';
|
||||
$icon_class[] = ! empty( $instance['linear_icon'] ) && $instance['icon_pack'] === 'linear_icons' ? 'lnr ' . $instance['linear_icon'] : '';
|
||||
$icon_class[] = ! empty( $instance['simple_line_icon'] ) && $instance['icon_pack'] === 'simple_line_icons' ? $instance['simple_line_icon'] : '';
|
||||
|
||||
$icon_class = implode( ' ', $icon_class );
|
||||
|
||||
$icon_holder_html = '<span class="' . $icon_class . '"></span>';
|
||||
}
|
||||
?>
|
||||
|
||||
<a class="eltdf-social-icon-widget-holder eltdf-icon-has-hover" <?php echo calla_elated_get_inline_attr( $hover_color, 'data-hover-color' ); ?> <?php calla_elated_inline_style( $icon_styles ); ?> href="<?php echo esc_url( $link ); ?>" target="<?php echo esc_attr( $target ); ?>">
|
||||
<?php echo wp_kses_post( $icon_holder_html ); ?>
|
||||
</a>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
if ( ! function_exists( 'calla_elated_register_social_icons_widget' ) ) {
|
||||
/**
|
||||
* Function that register social icon widget
|
||||
*/
|
||||
function calla_elated_register_social_icons_widget( $widgets ) {
|
||||
$widgets[] = 'CallaElatedClassIconsGroupWidget';
|
||||
|
||||
return $widgets;
|
||||
}
|
||||
|
||||
add_filter( 'calla_core_register_widgets', 'calla_elated_register_social_icons_widget' );
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
|
||||
include_once ELATED_FRAMEWORK_MODULES_ROOT_DIR . '/widgets/social-icons-group/functions.php';
|
||||
include_once ELATED_FRAMEWORK_MODULES_ROOT_DIR . '/widgets/social-icons-group/social-icons-group.php';
|
||||
@@ -0,0 +1,156 @@
|
||||
<?php
|
||||
|
||||
class CallaElatedClassIconsGroupWidget extends CallaElatedWidget {
|
||||
public function __construct() {
|
||||
parent::__construct(
|
||||
'eltdf_social_icons_group_widget',
|
||||
esc_html__( 'Elated Social Icons Group Widget', 'calla' ),
|
||||
array( 'description' => esc_html__( 'Use this widget to add a group of up to 6 social icons to a widget area.', 'calla' ) )
|
||||
);
|
||||
|
||||
$this->setParams();
|
||||
}
|
||||
|
||||
protected function setParams() {
|
||||
$this->params = array_merge(
|
||||
array(
|
||||
array(
|
||||
'type' => 'textfield',
|
||||
'name' => 'widget_title',
|
||||
'title' => esc_html__( 'Widget Title', 'calla' )
|
||||
)
|
||||
),
|
||||
calla_elated_icon_collections()->getSocialIconWidgetMultipleParamsArray(6),
|
||||
array(
|
||||
array(
|
||||
'type' => 'dropdown',
|
||||
'name' => 'layout',
|
||||
'title' => esc_html__( 'Icons Layout', 'calla' ),
|
||||
'options' => array(
|
||||
'' => esc_html__( 'Default', 'calla' ),
|
||||
'square-icons' => esc_html__( 'Square', 'calla' ),
|
||||
)
|
||||
),
|
||||
array(
|
||||
'type' => 'dropdown',
|
||||
'name' => 'skin',
|
||||
'title' => esc_html__( 'Square Icons Skin', 'calla' ),
|
||||
'description' => esc_html__( 'This applies to the square layout', 'calla' ),
|
||||
'options' => array(
|
||||
'' => esc_html__( 'Dark Skin', 'calla' ),
|
||||
'light-skin' => esc_html__( 'Light Skin', 'calla' ),
|
||||
)
|
||||
),
|
||||
array(
|
||||
'type' => 'dropdown',
|
||||
'name' => 'alignment',
|
||||
'title' => esc_html__( 'Text Alignment', 'calla' ),
|
||||
'options' => array(
|
||||
'left' => esc_html__( 'Left', 'calla' ),
|
||||
'center' => esc_html__( 'Center', 'calla' ),
|
||||
'right' => esc_html__( 'Right', 'calla' )
|
||||
)
|
||||
),
|
||||
array(
|
||||
'type' => 'textfield',
|
||||
'name' => 'icon_size',
|
||||
'title' => esc_html__( 'Icons Size (px)', 'calla' )
|
||||
),
|
||||
array(
|
||||
'type' => 'colorpicker',
|
||||
'name' => 'color',
|
||||
'title' => esc_html__( 'Color', 'calla' )
|
||||
),
|
||||
array(
|
||||
'type' => 'colorpicker',
|
||||
'name' => 'hover_color',
|
||||
'title' => esc_html__( 'Hover Color', 'calla' )
|
||||
),
|
||||
array(
|
||||
'type' => 'textfield',
|
||||
'name' => 'margin',
|
||||
'title' => esc_html__( 'Margin', 'calla' ),
|
||||
'description' => esc_html__( 'Insert margin in format: top right bottom left (e.g. 10px 5px 10px 5px)', 'calla' )
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public function widget( $args, $instance ) {
|
||||
$icon_styles = array();
|
||||
$class = array();
|
||||
|
||||
if ( ! empty( $instance['skin'] ) ) {
|
||||
$class[] = 'eltdf-' . $instance['skin'];
|
||||
}
|
||||
|
||||
if ( ! empty( $instance['layout'] ) ) {
|
||||
$class[] = 'eltdf-' . $instance['layout'] ;
|
||||
}
|
||||
|
||||
if ( ! empty( $instance['alignment'] ) ) {
|
||||
$class[] = 'text-align-' . $instance['alignment'];
|
||||
}
|
||||
|
||||
if ( ! empty( $instance['color'] ) ) {
|
||||
$icon_styles[] = 'color: ' . $instance['color'] . ';';
|
||||
}
|
||||
|
||||
if ( ! empty( $instance['icon_size'] ) ) {
|
||||
$icon_styles[] = 'font-size: ' . calla_elated_filter_px( $instance['icon_size'] ) . 'px';
|
||||
}
|
||||
|
||||
if ( ! empty( $instance['margin'] ) ) {
|
||||
$icon_styles[] = 'margin: ' . $instance['margin'] . ';';
|
||||
}
|
||||
|
||||
$hover_color = ! empty( $instance['hover_color'] ) ? $instance['hover_color'] : '';
|
||||
$class = implode( ' ', $class );
|
||||
|
||||
echo '<div class="widget eltdf-social-icons-group-widget ' . esc_attr($class) . '">';
|
||||
|
||||
if ( ! empty( $instance['widget_title'] ) ) {
|
||||
echo wp_kses_post( $args['before_title'] ) . esc_html( $instance['widget_title'] ) . wp_kses_post( $args['after_title'] );
|
||||
}
|
||||
|
||||
for ( $n = 1; $n <= 6; $n++ ) {
|
||||
$link = ! empty( $instance[ 'link_' . $n ] ) ? $instance[ 'link_' . $n ] : '#';
|
||||
$target = ! empty( $instance[ 'target_' . $n ] ) ? $instance[ 'target_' . $n ] : '_self';
|
||||
|
||||
$icon_holder_html = '';
|
||||
if ( ! empty( $instance['icon_pack'] ) ) {
|
||||
$icon_class = array( 'eltdf-social-icon-widget' );
|
||||
if ( ! empty( $instance[ 'fa_icon_' . $n ] ) && $instance['icon_pack'] === 'font_awesome' ) {
|
||||
$icon_class[] = 'fa ' . $instance[ 'fa_icon_' . $n ];
|
||||
}
|
||||
|
||||
if ( ! empty( $instance[ 'fe_icon_' . $n ] ) && $instance['icon_pack'] === 'font_elegant' ) {
|
||||
$icon_class[] = $instance[ 'fe_icon_' . $n ];
|
||||
}
|
||||
|
||||
if ( ! empty( $instance[ 'ion_icon_' . $n ] ) && $instance['icon_pack'] === 'ion_icons' ) {
|
||||
$icon_class[] = $instance[ 'ion_icon_' . $n ];
|
||||
}
|
||||
|
||||
if ( ! empty( $instance[ 'simple_line_icon_' . $n ] ) && $instance['icon_pack'] === 'simple_line_icons' ) {
|
||||
$icon_class[] = $instance[ 'simple_line_icon_' . $n ];
|
||||
}
|
||||
|
||||
if ( ! empty( $icon_class ) && isset( $icon_class[1] ) && ! empty( $icon_class[1] ) ) {
|
||||
$icon_class = implode( ' ', $icon_class );
|
||||
$icon_holder_html = '<span class="' . $icon_class . '"></span>';
|
||||
} else {
|
||||
$icon_holder_html = '';
|
||||
}
|
||||
}
|
||||
?>
|
||||
<?php if ( ! empty( $icon_holder_html ) ) { ?>
|
||||
<a class="eltdf-social-icon-widget-holder eltdf-icon-has-hover" <?php echo calla_elated_get_inline_attr( $hover_color, 'data-hover-color' ); ?> <?php calla_elated_inline_style( $icon_styles ) ?>
|
||||
href="<?php echo esc_url( $link ); ?>" target="<?php echo esc_attr( $target ); ?>">
|
||||
<?php echo wp_kses_post( $icon_holder_html ); ?>
|
||||
</a>
|
||||
<?php }
|
||||
}
|
||||
echo '</div>';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
if(!function_exists('calla_elated_register_sticky_sidebar_widget')) {
|
||||
/**
|
||||
* Function that register sticky sidebar widget
|
||||
*/
|
||||
function calla_elated_register_sticky_sidebar_widget($widgets) {
|
||||
$widgets[] = 'CallaElatedStickySidebar';
|
||||
|
||||
return $widgets;
|
||||
}
|
||||
|
||||
add_filter('calla_core_register_widgets', 'calla_elated_register_sticky_sidebar_widget');
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
|
||||
include_once ELATED_FRAMEWORK_MODULES_ROOT_DIR . '/widgets/sticky-sidebar/functions.php';
|
||||
include_once ELATED_FRAMEWORK_MODULES_ROOT_DIR . '/widgets/sticky-sidebar/sticky-sidebar.php';
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
class CallaElatedStickySidebar extends CallaElatedWidget {
|
||||
public function __construct() {
|
||||
parent::__construct(
|
||||
'eltdf_sticky_sidebar',
|
||||
esc_html__('Elated Sticky Sidebar Widget', 'calla'),
|
||||
array( 'description' => esc_html__( 'Use this widget to make the sidebar sticky. Drag it into the sidebar above the widget which you want to be the first element in the sticky sidebar.', 'calla'))
|
||||
);
|
||||
|
||||
$this->setParams();
|
||||
}
|
||||
|
||||
protected function setParams() {}
|
||||
|
||||
public function widget( $args, $instance ) {
|
||||
echo '<div class="widget eltdf-widget-sticky-sidebar"></div>';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
if ( ! function_exists( 'calla_elated_register_vertical_separator_widget' ) ) {
|
||||
/**
|
||||
* Function that register vertical separator widget
|
||||
*/
|
||||
function calla_elated_register_vertical_separator_widget( $widgets ) {
|
||||
$widgets[] = 'CallaElatedVerticalSeparatorWidget';
|
||||
|
||||
return $widgets;
|
||||
}
|
||||
|
||||
add_filter( 'calla_core_register_widgets', 'calla_elated_register_vertical_separator_widget' );
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
|
||||
include_once ELATED_FRAMEWORK_MODULES_ROOT_DIR . '/widgets/vertical-separator/functions.php';
|
||||
include_once ELATED_FRAMEWORK_MODULES_ROOT_DIR . '/widgets/vertical-separator/vertical-separator.php';
|
||||
@@ -0,0 +1,129 @@
|
||||
<?php
|
||||
|
||||
class CallaElatedVerticalSeparatorWidget extends CallaElatedWidget {
|
||||
public function __construct() {
|
||||
parent::__construct(
|
||||
'eltdf_vertical_separator_widget',
|
||||
esc_html__( 'Elated Vertical Separator Widget', 'calla' ),
|
||||
array( 'description' => esc_html__( 'Add a vertical separator element to your widget areas', 'calla' ) )
|
||||
);
|
||||
|
||||
$this->setParams();
|
||||
}
|
||||
|
||||
protected function setParams() {
|
||||
$this->params = array(
|
||||
array(
|
||||
'type' => 'dropdown',
|
||||
'name' => 'type',
|
||||
'title' => esc_html__( 'Holder Height', 'calla' ),
|
||||
'options' => array(
|
||||
'full-height' => esc_html__( 'Full Height', 'calla' ),
|
||||
'custom-height' => esc_html__( 'Custom Height', 'calla' ),
|
||||
)
|
||||
),
|
||||
array(
|
||||
'type' => 'dropdown',
|
||||
'name' => 'align',
|
||||
'title' => esc_html__( 'Vertical Align', 'calla' ),
|
||||
'options' => array(
|
||||
'middle' => esc_html__( 'Middle', 'calla' ),
|
||||
'top' => esc_html__( 'Top', 'calla' ),
|
||||
'bottom' => esc_html__( 'Bottom', 'calla' )
|
||||
)
|
||||
),
|
||||
array(
|
||||
'type' => 'textfield',
|
||||
'name' => 'height',
|
||||
'title' => esc_html__( 'Height (px or %)', 'calla' ),
|
||||
'description' => esc_html__('The percentage applies only if the \'Full Holder Height\' is selected','calla')
|
||||
),
|
||||
array(
|
||||
'type' => 'dropdown',
|
||||
'name' => 'border_style',
|
||||
'title' => esc_html__( 'Style', 'calla' ),
|
||||
'options' => array(
|
||||
'solid' => esc_html__( 'Solid', 'calla' ),
|
||||
'dashed' => esc_html__( 'Dashed', 'calla' ),
|
||||
'dotted' => esc_html__( 'Dotted', 'calla' )
|
||||
)
|
||||
),
|
||||
array(
|
||||
'type' => 'colorpicker',
|
||||
'name' => 'color',
|
||||
'title' => esc_html__( 'Color', 'calla' )
|
||||
),
|
||||
array(
|
||||
'type' => 'textfield',
|
||||
'name' => 'thickness',
|
||||
'title' => esc_html__( 'Thickness (px)', 'calla' )
|
||||
),
|
||||
array(
|
||||
'type' => 'textfield',
|
||||
'name' => 'left_margin',
|
||||
'title' => esc_html__( 'Left Margin (px)', 'calla' )
|
||||
),
|
||||
array(
|
||||
'type' => 'textfield',
|
||||
'name' => 'right_margin',
|
||||
'title' => esc_html__( 'Right Margin (px)', 'calla' )
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public function widget( $args, $instance ) {
|
||||
if ( ! is_array( $instance ) ) {
|
||||
$instance = array();
|
||||
}
|
||||
|
||||
$holder_class = '';
|
||||
|
||||
if ($instance['type'] == 'full-height') {
|
||||
$holder_class = 'eltdf-vertical-separator-full-height';
|
||||
}
|
||||
|
||||
$style = array();
|
||||
|
||||
if ($instance['align'] !== '') {
|
||||
$style[] = 'vertical-align:'.$instance['align'];
|
||||
}
|
||||
|
||||
if ($instance['height'] !== '') {
|
||||
if (calla_elated_string_ends_with($instance['height'],'%')){
|
||||
$height = $instance['height'];
|
||||
} else {
|
||||
$height = calla_elated_filter_px($instance['height']).'px';
|
||||
}
|
||||
$style[] = 'height:'.$height;
|
||||
}
|
||||
|
||||
if ($instance['border_style'] !== '') {
|
||||
$style[] = 'border-style:'.$instance['border_style'];
|
||||
}
|
||||
|
||||
if ($instance['color'] !== '') {
|
||||
$style[] = 'border-color:'.$instance['color'];
|
||||
}
|
||||
|
||||
if ($instance['thickness'] !== '') {
|
||||
$style[] = 'border-width:'.calla_elated_filter_px($instance['thickness']).'px';
|
||||
}
|
||||
|
||||
if ($instance['left_margin'] !== '') {
|
||||
$style[] = 'margin-left:'.calla_elated_filter_px($instance['left_margin']).'px';
|
||||
}
|
||||
|
||||
if ($instance['right_margin'] !== '') {
|
||||
$style[] = 'margin-right:'.calla_elated_filter_px($instance['right_margin']).'px';
|
||||
}
|
||||
|
||||
$html = '';
|
||||
|
||||
$html .= '<div class="widget eltdf-vertical-separator-widget '.esc_attr($holder_class).'">';
|
||||
$html .= '<span class="eltdf-vsw-height-holder"></span>';
|
||||
$html .= '<span class="eltdf-vsw" '.calla_elated_get_inline_style($style).'></span>';
|
||||
$html .= '</div>';
|
||||
|
||||
echo wp_kses_post($html);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user