File: /home/platne/serwer143450/public_html/exzo.hillconnect.pl/wp-content/themes/exzo/assets/widgets.php
<?php
add_action( 'widgets_init', 'exzo_widgets_int' );
function exzo_widgets_int() {
//sidibar widget
register_widget( 'exzo_Recent_posts' );
register_widget( 'exzo_video' );
register_widget( 'exzo_footer_info' );
register_widget( 'exzo_CATEGORIES_Wigdet_class' );
register_widget( 'exzo_menu_Wigdet_class' );
register_widget( 'exzo_Recent_posts2' );
register_widget( 'exzo_CATEGORIES_sidebar' );
//shop widget
register_widget( 'exzo_PRICE_FILTER_class' );
register_widget( 'exzo_brand_FILTER_class' );
register_widget( 'exzo_groups_class' );
register_widget( 'exzo_Widget_Product_Tag_Cloud' );
register_widget( 'exzo_color_FILTER_class' );
register_widget( 'exzo_custom_product_2_class' );
}
class exzo_color_FILTER_class extends WP_Widget {
function __construct() {
$args = array(
'name' => esc_html__( 'exzo color filter', 'exzo' ),
'description' => esc_html__( 'It colors', 'exzo' ),
'classname' => 'widget-filter-color'
);
parent::__construct( '', '', $args );
}
/**
* method to display in the admin
*
* @param $instance
*/
function form( $instance ) {
$nav_menu = isset( $instance['nav_menu'] ) ? $instance['nav_menu'] : '';
$nav_menu = isset( $instance['title'] ) ? $instance['title'] : '';
extract( $instance );
$taxonomies = get_taxonomies();
?>
<p>
<label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"> <?php esc_html_e( 'Title:',
'exzo' ); ?></label>
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"
name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text"
value="<?php if ( isset( $title ) ) {
echo esc_attr( $title );
} else {
esc_html_e( 'CHOOSE COLOR', 'exzo' );
} ?>">
</p>
<p>
<label
for="<?php echo esc_attr( $this->get_field_id( 'nav_menu' ) ); ?>"> <?php esc_html_e( 'Please select the color attribute:',
'exzo' ); ?></label>
<select id="<?php echo esc_attr( $this->get_field_id( 'nav_menu' ) ); ?>"
name="<?php echo esc_attr( $this->get_field_name( 'nav_menu' ) ); ?>">
<option value="0"><?php esc_html_e( '— Select —', 'exzo' ); ?></option>
<?php foreach ( $taxonomies as $item ) :
if ( strpos( $item, 'pa_' ) === false ) {
continue;
}
$tax = get_taxonomy( $item );
?>
<option
value="<?php echo esc_attr( $item ); ?>" <?php selected( $nav_menu, $item ); ?>>
<?php echo esc_html( $tax->labels->name ); ?>
</option>
<?php endforeach; ?>
</select>
</p>
<?php
}
/**
* frontend for the site
*
* @param $args
* @param $instance
*/
function widget( $args, $instance ) {
$nav_menu = isset( $instance['nav_menu'] ) ? $instance['nav_menu'] : '';
$nav_menu = isset( $instance['title'] ) ? $instance['title'] : '';
extract( $args );
extract( $instance );
$args['before_title'] = str_replace( 'class="', 'class=" h4 col-xs-b25 ', $args['before_title'] );
echo wp_kses_post( $before_widget . "" );
if ( isset( $title ) ) {
echo wp_kses_post( $args['before_title'] . $title . $args['after_title'] );
}
$nav_menu = isset( $instance['nav_menu'] ) ? $instance['nav_menu'] : '';
if ( function_exists( 'get_woocommerce_term_meta' ) && strpos( $nav_menu, 'pa_' ) !== false ) {
$args = array(
'taxonomy' => $nav_menu,
'hide_empty' => false,
);
$arr_color = null;
// get all terms
$terms = get_terms( $args );
if ( $terms ) {
foreach ( $terms as $term ) {
$term_id = $term->term_id;
$thumbnail_id = get_woocommerce_term_meta( $term_id, '', 'phoen_color', true );
// if terms has color
if ( isset( $thumbnail_id[ sanitize_title( $nav_menu ) . '_thumbnail_id_phoen_color' ][0] ) ) {
$color = true;
$arr_color[] = array(
'slug' => $term->slug,
'color_hex' => $thumbnail_id[ sanitize_title( $nav_menu ) . '_thumbnail_id_phoen_color' ][0]
);
}
}
}
?>
<div class="color-selection size-1">
<?php if ( $arr_color ) {
foreach ( $arr_color as $item ) {
?>
<div data-term="<?php echo esc_attr( $item['slug'] ); ?>"
data-tax="<?php echo esc_attr( $nav_menu ); ?>"
class="entry <?php if ( isset( $_GET['term'] ) && $_GET['term'] == $item['slug'] ) {
echo 'active';
} ?>"
style="color: <?php echo esc_attr( $item['color_hex'] ) ?>;"></div>
<?php }
} ?>
</div>
<?php
}
//parent cat
echo wp_kses_post( $after_widget );
}
/*
* a method which, when the update of the widget is executed
*
* @param $new_instance
* @param $old_instance
* @return mixed
*/
}
class exzo_brand_FILTER_class extends WP_Widget {
function __construct() {
$args = array(
'name' => esc_html__( 'exzo BRANDS filter', 'exzo' ),
'description' => esc_html__( 'It displays brands', 'exzo' ),
'classname' => 'widget-filter-brands'
);
parent::__construct( '', '', $args );
}
/**
* method to display in the admin
*
* @param $instance
*/
function form( $instance ) {
extract( $instance );
?>
<p>
<label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"> <?php esc_html_e( 'Title:',
'exzo' ); ?></label>
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"
name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text"
value="<?php if ( isset( $title ) ) {
echo esc_attr( $title );
} else {
esc_html_e( 'Brands', 'exzo' );
} ?>">
</p>
<?php
}
/**
* frontend for the site
*
* @param $args
* @param $instance
*/
function widget( $args, $instance ) {
extract( $args );
extract( $instance );
$args['before_title'] = str_replace( 'class="', 'class=" h4 col-xs-b25 ', $args['before_title'] );
echo wp_kses_post( $before_widget . "" );
$title = sanitize_text_field( apply_filters( 'widget_title', $title ) );
?>
<?php
if ( $title ) {
echo wp_kses_post( $args['before_title'] . $title . $args['after_title'] );
} ?>
<?php
$categories = get_categories( "parent=0&taxonomy=product_brands&hide_empty=0" );
foreach ( $categories as $cat ) {
//parent cat
$filter = get_query_var( 'product_brands' );
if ( isset( $_GET['tax'] ) && isset( $_GET['term'] ) ) {
$filter = sanitize_text_field( $_GET['term'] );
}
?>
<form class="filter_product_group" action="#">
<label class="checkbox-entry">
<input class="exzo_filter_tax"
data-tax="product_brands" data-term="<?php echo esc_html( $cat->slug ); ?>"
type="checkbox" <?php checked( $filter, $cat->slug ); ?>
name="<?php echo esc_html( $cat->slug ); ?>"><span><?php echo esc_html( $cat->name ); ?>
</span>
</label>
<div class="empty-space col-xs-b10"></div>
</form>
<?php
}
?>
<?php
echo wp_kses_post( $after_widget );
}
/*
* a method which, when the update of the widget is executed
*
* @param $new_instance
* @param $old_instance
* @return mixed
*/
function update( $new_instance, $old_instance ) {
$instance['title'] = ( ! empty( $new_instance['title'] ) && strlen( $new_instance['title'] ) > 1 ) ? esc_attr( $new_instance['title'] ) :
esc_html__( "Brands", 'exzo' );
$instance['type_tag'] = $new_instance['type_tag'] ? (int) sanitize_title( $new_instance['type_tag'] ) : '0';
return $instance;
}
}
class exzo_groups_class extends WP_Widget {
function __construct() {
$args = array(
'name' => esc_html__( 'exzo Groups filter ', 'exzo' ),
'description' => esc_html__( 'It displays grups filter in shop page', 'exzo' ),
'classname' => 'widget-filter-grups'
);
parent::__construct( '', '', $args );
}
/**
* method to display in the admin
*
* @param $instance
*/
function form( $instance ) {
$instance = wp_parse_args( (array) $instance,
array(
'filter' => '',
) );
extract( $instance );
?>
<p>
<label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"> <?php esc_html_e( 'Title:',
'exzo' ); ?></label>
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"
name="<?php echo esc_attr( esc_attr( $this->get_field_name( 'title' ) ) ); ?>" type="text"
value="<?php if ( isset( $title ) ) {
echo esc_attr( $title );
} else {
esc_html_e( 'grup', 'exzo' );
} ?>">
</p>
<?php
}
/**
* frontend for the site
*
* @param $args
* @param $instance
*/
function widget( $args, $instance ) {
extract( $args );
extract( $instance );
$args['before_title'] = str_replace( 'class="', 'class=" h4 col-xs-b25 ', $args['before_title'] );
echo wp_kses_post( $before_widget . "" );
$title = sanitize_text_field( apply_filters( 'widget_title', $title ) );
?>
<?php
if ( $title ) {
echo wp_kses_post( $args['before_title'] . $title . $args['after_title'] );
} ?>
<?php
$categories = get_categories( "parent=0&taxonomy=product_group&hide_empty=1" );
?>
<form class="filter_product_group" action="#"><?php
$this->buildTree(0,0,0)
?>
</form>
<?php
echo wp_kses_post( $after_widget );
}
function buildTree( $activeCatId, $activeParentId, $parentId = 0 ) {
$filter = get_query_var( 'product_group' );
if ( isset( $_GET['tax'] ) && isset( $_GET['term'] ) ) {
$filter = sanitize_text_field( $_GET['term'] );
}
$output = '';
$terms = get_terms( array(
'taxonomy' => 'product_group',
'hide_empty' => true,
'hierarchical' => true,
'parent' => $parentId
) );
if ( count( $terms ) ) {
?>
<ul>
<?php foreach ( $terms as $cat ) { ?>
<li>
<label class="checkbox-entry">
<input class="exzo_filter_tax" data-tax="product_group"
data-term="<?php echo esc_html( $cat->slug ); ?>"
type="checkbox" <?php checked( $filter, $cat->slug ); ?>><span><?php echo esc_html( $cat->name ); ?>
</span>
</label>
<div class="empty-space col-xs-b10"></div>
<?php $this->buildTree($activeCatId, $activeParentId, $cat->term_id) ?>
</li>
<?php } ?>
</ul>
<?php
}
}
/*
* a method which, when the update of the widget is executed
*
* @param $new_instance
* @param $old_instance
* @return mixed
*/
function update( $new_instance, $old_instance ) {
$instance['title'] = ( ! empty( $new_instance['title'] ) && strlen( $new_instance['title'] ) > 1 ) ? esc_attr( $new_instance['title'] ) :
esc_html__( "Brands", 'exzo' );
$instance['type_tag'] = $new_instance['type_tag'] ? (int) sanitize_title( $new_instance['type_tag'] ) : '0';
return $instance;
}
}
class exzo_PRICE_FILTER_class extends WP_Widget {
function __construct() {
$args = array(
'name' => esc_html__( 'exzo PRICE filter', 'exzo' ),
'description' => esc_html__( 'It displays Filter price', 'exzo' ),
'classname' => 'widget-filter-price'
);
parent::__construct( '', '', $args );
}
/**
* method to display in the admin
*
* @param $instance
*/
function form( $instance ) {
$instance = wp_parse_args(
(array) $instance,
array(
'title' => esc_html__( 'PRICE', 'exzo' ), // Legacy.
'text_button' => esc_html__( 'Filter', 'exzo' ), // Legacy.
'min_price' => esc_html__( '40', 'exzo' ), // Legacy.
'max_price' => esc_html__( '1000', 'exzo' ), // Legacy.
)
);
extract( $instance );
?>
<p>
<label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"> <?php esc_html_e( 'Title:',
'exzo' ); ?></label>
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"
name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text"
value="<?php if ( isset( $title ) ) {
echo esc_attr( $title );
} ?>">
</p>
<p>
<label
for="<?php echo esc_attr( $this->get_field_id( 'text_button' ) ); ?>"> <?php esc_html_e( 'text button:',
'exzo' ); ?></label>
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'text_button' ) ); ?>"
name="<?php echo esc_attr( $this->get_field_name( 'text_button' ) ); ?>" type="text"
value="<?php if ( isset( $text_button ) ) {
echo esc_attr( $text_button );
} ?>">
</p>
<p>
<label
for="<?php echo esc_attr( $this->get_field_id( 'min_price' ) ); ?>"> <?php esc_html_e( 'insert max price',
'exzo' ); ?></label>
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'min_price' ) ); ?>"
name="<?php echo esc_attr( $this->get_field_name( 'min_price' ) ); ?>" type="text"
value="<?php if ( isset( $min_price ) ) {
echo esc_attr( $min_price );
} ?>">
</p>
<p>
<label
for="<?php echo esc_attr( $this->get_field_id( 'max_price' ) ); ?>"> <?php esc_html_e( 'Insert min price',
'exzo' ); ?></label>
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'max_price' ) ); ?>"
name="<?php echo esc_attr( $this->get_field_name( 'max_price' ) ); ?>" type="text"
value="<?php if ( isset( $max_price ) ) {
echo esc_attr( $max_price );
} ?>">
</p>
<?php
}
/**
* frontend for the site
*
* @param $args
* @param $instance
*/
function widget( $args, $instance ) {
//default values
$instance = wp_parse_args(
(array) $instance,
array(
'title' => esc_html__( 'PRICE', 'exzo' ), // Legacy.
'text_button' => esc_html__( 'Filter', 'exzo' ), // Legacy.
'min_price' => esc_html__( '40', 'exzo' ), // Legacy.
'max_price' => esc_html__( '1000', 'exzo' ), // Legacy.
)
);
extract( $args );
extract( $instance );
// Create a filter to the other plug-ins can change them
$title = sanitize_text_field( apply_filters( 'widget_title', $title ) );
$before_widget = str_ireplace( 'class="widget"', 'class="widget widget-tag-cloud"', $before_widget );
echo wp_kses_post( $before_widget . "" );
echo wp_kses_post( $before_title ) . esc_attr( $title ) . wp_kses_post( $after_title );
?>
<form action="<?php echo esc_url( get_permalink( wc_get_page_id( ( 'shop' ) ) ) ); ?>"
method="get">
<div id="prices-range"></div>
<div class="simple-article size-1"> <?php echo esc_html__( 'PRICE:', 'exzo' ) ?>
<b id="exzo_price_amount" class="grey">
<?php
if ( isset( $_GET['min_price'] ) && isset( $_GET['max_price'] ) ) {
?>
<input
data-min="<?php echo (int) esc_attr( $min_price ); ?>"
data-max="<?php echo (int) esc_attr( $max_price ); ?>"
data-value_min="<?php echo esc_attr( $_GET['min_price'] ); ?>"
data-value_max="<?php echo esc_attr( $_GET['max_price'] ); ?>" value=""
type="text" id="amount" readonly/>
<?php
} else {
?>
<input
data-min="<?php echo (int) esc_attr( $min_price ); ?>"
data-max="<?php echo (int) esc_attr( $max_price ); ?>"
data-value_min="<?php echo (int) esc_attr( $min_price ); ?>"
data-value_max="<?php echo (int) esc_attr( $max_price ); ?>"
value=""
type="text" id="amount" readonly/>
<?php
}
?>
<input type="hidden" id="exzo_min_price" name="min_price" value="">
<input type="hidden" id="exzo_max_price" name="max_price" value="">
</b>
</div>
<div class="button size-1 style-3">
<span class="button-wrapper">
<span class="icon"><img
src="<?php echo esc_url( get_template_directory_uri() ); ?>/img/icon-4.png"
alt=""></span>
<span class="text"><?php echo esc_html( $text_button ); ?></span>
</span>
<input type="submit" class="button size-lg" name="update_cart" value="Add to cart">
</div>
</form>
<?php
echo wp_kses_post( $after_widget );
}
function update( $new_instance, $old_instance ) {
return $new_instance;
}
}
class exzo_CATEGORIES_sidebar extends WP_Widget {
/**
* Register the new widget
*/
function __construct() {
$args = array(
'name' => esc_html__( 'exzo sidebar CATEGORIES', 'exzo' ),
'description' => esc_html__( 'It displays a Categories list ', 'exzo' ),
'classname' => 'exzo_Search'
);
parent::__construct( 'exzo_Categories_sidebar', 'exzo Categories sidebar', $args );
}
/**
* method to display in the admin
*
* @param $instance
*/
function form( $instance ) {
$instance = wp_parse_args( (array) $instance,
array(
'filter2' => '',
'taxonomy' => '',
) );
extract( $instance );
?>
<p>
<label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"> <?php esc_html_e( 'Title:',
'exzo' ); ?></label>
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"
name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text"
value="<?php if ( isset( $title ) ) {
echo esc_attr( $title );
} else {
esc_html_e( 'CATEGORIES', 'exzo' );
} ?>">
</p>
<p>
<label for="<?php echo esc_attr( $this->get_field_id( 'taxonomy' ) ); ?>"> <?php esc_html_e( 'Insert Taxonomy:',
'exzo' ); ?></label>
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'taxonomy' ) ); ?>"
name="<?php echo esc_attr( $this->get_field_name( 'taxonomy' ) ); ?>" type="text"
value="<?php if ( isset( $taxonomy ) ) {
echo esc_attr( $taxonomy );
} else {
esc_html_e( 'product_cat', 'exzo' );
}
?>">
</p>
<p><input id="<?php echo esc_attr( $this->get_field_id( 'filter2' ) ); ?>"
name="<?php echo esc_attr( $this->get_field_name( 'filter2' ) ); ?>"
type="checkbox"<?php checked( $filter2 ); ?> /> <label
for="<?php echo esc_attr( $this->get_field_id( 'filter2' ) ); ?>"><?php esc_html_e( 'Drop down links align right', 'exzo' ); ?></label>
</p>
<?php
}
/**
* frontend for the site
*
* @param $args
* @param $instance
*/
function widget( $args, $instance ) {
extract( $args );
$instance = wp_parse_args(
(array) $instance,
array(
'filter2' => '',
'taxonomy' => esc_html__( 'product_cat', 'exzo' ),
)
);
extract( $instance );
echo wp_kses_post( $before_widget . "" );
$title = sanitize_text_field( apply_filters( 'widget_title', $title ) );
$class = 'transparent';
$class2 = 'alignleft';
if ( $title ) {
echo wp_kses_post( $args['before_title'] . $title . $args['after_title'] );
} ?>
<ul class="categories-menu <?php if ( ! empty( $instance['filter'] ) ) {
echo esc_attr( $class2 );
} else {
echo esc_attr( $class );
} ?>">
<?php
$categories = get_categories( "parent=0&taxonomy=$taxonomy&hide_empty=1&hierarchical=true" );
foreach ( $categories as $cat ) {
//parent cat
$chald = get_term_children( $cat->term_id, $taxonomy );
$chald = implode( ',', $chald );
?>
<li>
<?php
// if this is chald cat
if ( ! ( empty( $chald ) ) ) {
$args = array(
'taxonomy' => $taxonomy,
'hide_empty' => 1,
'include' => $chald
);
$categories2 = get_categories( $args );
?>
<a href="<?php echo esc_url( get_term_link( $cat->term_id, $taxonomy ) ); ?>"> <?php echo esc_html( $cat->name ); ?></a>
<div class="toggle "></div>
<ul>
<?php
foreach ( $categories2 as $cat_chald ) {
?>
<li>
<a href="<?php echo esc_url( get_term_link( $cat_chald->term_id, $taxonomy ) ); ?>"> <?php
echo esc_html( $cat_chald->name ); ?></a>
</li>
<?php
} ?>
</ul>
<?php
} else {
?>
<a href="<?php echo esc_url( get_term_link( $cat->term_id, $taxonomy ) ); ?>"> <?php echo esc_html( $cat->name ); ?></a>
<?php
}
?>
</li>
<?php
}
?>
</ul>
<div class="empty-space col-xs-b25 col-sm-b50"></div>
<br><br>
<?php
echo wp_kses_post( $after_widget );
}
/*
* a method which, when the update of the widget is executed
*
* @param $new_instance
* @param $old_instance
* @return mixed
*/
function update( $new_instance, $old_instance ) {
$instance = $old_instance;
$instance['title'] = ( ! empty( $new_instance['title'] ) && strlen( $new_instance['title'] ) > 1 ) ? esc_attr( $new_instance['title'] ) :
esc_html__( "CATEGORIES", 'exzo' );
$instance['type_tag'] = $new_instance['type_tag'] ? (int) sanitize_title( $new_instance['type_tag'] ) : '0';
$instance['filter2'] = ! empty( $new_instance['filter2'] );
$instance['checkbox_key'] = ( ! empty( $new_instance['checkbox_key'] ) ) ? strip_tags( $new_instance['checkbox_key'] ) : '';
$instance['taxonomy'] = ( ! empty( $new_instance['taxonomy'] ) && strlen( $new_instance['taxonomy'] ) > 1 ) ? esc_attr( $new_instance['taxonomy'] ) :
esc_html__( "product_cat", 'exzo' );
return $instance;
}
}
class exzo_menu_Wigdet_class extends WP_Widget {
/**
* Register the new widget
*/
function __construct() {
$args = array(
'name' => esc_html__( 'exzo MENU', 'exzo' ),
'description' => esc_html__( 'It displays a menu ', 'exzo' ),
'classname' => 'exzo_menu'
);
parent::__construct( 'exzo_menu', 'exzo_menu ', $args );
}
/**
* Outputs the content for the current Custom Menu widget instance.
*
* @param array $args Display arguments including 'before_title', 'after_title',
* 'before_widget', and 'after_widget'.
* @param array $instance Settings for the current Custom Menu widget instance.
*
* @since 3.0.0
* @access public
*
*/
public function widget( $args, $instance ) {
// Get menu
$nav_menu = ! empty( $instance['nav_menu'] ) ? wp_get_nav_menu_object( $instance['nav_menu'] ) : false;
$nav_menu2 = ! empty( $instance['nav_menu2'] ) ? wp_get_nav_menu_object( $instance['nav_menu2'] ) : false;
if ( ! $nav_menu ) {
return;
}
/** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */
$instance['title'] = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base );
echo wp_kses_post( $args['before_widget'] );
?>
<?php
if ( ! empty( $instance['title'] ) ) {
echo wp_kses_post( $args['before_title'] . $instance['title'] . $args['after_title'] );
$exzo_settings = get_exzo_settings();
if ( isset( $exzo_settings['exzo_rtl'] ) && $exzo_settings['exzo_rtl'] == true ) {
?>
<div class="empty-space col-xs-b20"></div>
<?php
}
}
?>
<div class="footer-column-links">
<div class="row">
<div class="col-xs-6">
<?php
$nav_menu_args = array(
'fallback_cb' => '',
'menu' => $nav_menu
);
/**
* Filters the arguments for the Custom Menu widget.
*
* @param array $nav_menu_args {
* An array of arguments passed to wp_nav_menu() to retrieve a custom menu.
*
* @type callable|bool $fallback_cb Callback to fire if the menu doesn't exist. Default empty.
* @type mixed $menu Menu ID, slug, or name.
* }
*
* @param stdClass $nav_menu Nav menu object for the current menu.
* @param array $args Display arguments for the current widget.
* @param array $instance Array of settings for the current widget.
*
* @since 4.2.0
* @since 4.4.0 Added the `$instance` parameter.
*
*/
wp_nav_menu( apply_filters( 'widget_nav_menu_args', $nav_menu_args, $nav_menu, $args, $instance ) );
?>
</div>
<?php if ( ! $nav_menu2 ) {
return;
} ?>
<div class="col-xs-6">
<?php
$nav_menu_args2 = array(
'fallback_cb' => '',
'menu' => $nav_menu2
);
/**
* Filters the arguments for the Custom Menu widget.
*
* @param array $nav_menu_args {
* An array of arguments passed to wp_nav_menu() to retrieve a custom menu.
*
* @type callable|bool $fallback_cb Callback to fire if the menu doesn't exist. Default empty.
* @type mixed $menu Menu ID, slug, or name.
* }
*
* @param stdClass $nav_menu Nav menu object for the current menu.
* @param array $args Display arguments for the current widget.
* @param array $instance Array of settings for the current widget.
*
* @since 4.2.0
* @since 4.4.0 Added the `$instance` parameter.
*
*/
wp_nav_menu( apply_filters( 'widget_nav_menu_args', $nav_menu_args2, $nav_menu2, $args, $instance ) );
?>
</div>
</div>
</div>
<?php
echo wp_kses_post( $args['after_widget'] );
}
/**
* Handles updating settings for the current Custom Menu widget instance.
*
* @param array $new_instance New settings for this instance as input by the user via
* WP_Widget::form().
* @param array $old_instance Old settings for this instance.
*
* @return array Updated settings to save.
* @since 3.0.0
* @access public
*
*/
public function update( $new_instance, $old_instance ) {
$instance = array();
if ( ! empty( $new_instance['title'] ) ) {
$instance['title'] = sanitize_text_field( $new_instance['title'] );
}
if ( ! empty( $new_instance['nav_menu'] ) ) {
$instance['nav_menu'] = (int) $new_instance['nav_menu'];
}
if ( ! empty( $new_instance['title2'] ) ) {
$instance['title2'] = sanitize_text_field( $new_instance['title2'] );
}
if ( ! empty( $new_instance['nav_menu2'] ) ) {
$instance['nav_menu2'] = (int) $new_instance['nav_menu2'];
}
return $instance;
}
/**
* Outputs the settings form for the Custom Menu widget.
*
* @param array $instance Current settings.
*
* @since 3.0.0
* @access public
*
* @global WP_Customize_Manager $wp_customize
*/
public function form( $instance ) {
$title = isset( $instance['title'] ) ? $instance['title'] : '';
$nav_menu = isset( $instance['nav_menu'] ) ? $instance['nav_menu'] : '';
$title2 = isset( $instance['title2'] ) ? $instance['title2'] : '';
$nav_menu2 = isset( $instance['nav_menu2'] ) ? $instance['nav_menu2'] : '';
// Get menus
$menus = wp_get_nav_menus();
$menus2 = wp_get_nav_menus();
// If no menus exists, direct the user to go and create some.
?>
<p class="nav-menu-widget-no-menus-message" <?php if ( ! empty( $menus ) ) {
echo ' style="display:none" ';
} ?>>
<?php
if ( isset( $GLOBALS['wp_customize'] ) && $GLOBALS['wp_customize'] instanceof WP_Customize_Manager ) {
$url = 'javascript: wp.customize.panel( "nav_menus" ).focus();';
} else {
$url = admin_url( 'nav-menus.php' );
}
?>
<?php echo sprintf( esc_html__( 'No menus have been created yet.', "exzo" ) . '<a href="%s">' . esc_html__( "Create some", "exzo" ) . '</a>.', esc_attr( $url ) ); ?>
</p>
<div class="nav-menu-widget-form-controls" <?php if ( empty( $menus ) ) {
echo ' style="display:none" ';
} ?>>
<p><?php echo esc_html__( 'LEFT MENU', 'exzo' ); ?></p>
<p>
<label
for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php esc_html_e( 'Title:', 'exzo' ) ?></label>
<input type="text" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"
name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>"
value="<?php echo esc_attr( $title ); ?>"/>
</p>
<p>
<label
for="<?php echo esc_attr( $this->get_field_id( 'nav_menu' ) ); ?>"><?php esc_html_e( 'Select Menu:', 'exzo' ); ?></label>
<select id="<?php echo esc_attr( $this->get_field_id( 'nav_menu' ) ); ?>"
name="<?php echo esc_attr( $this->get_field_name( 'nav_menu' ) ); ?>">
<option value="0"><?php esc_html_e( '— Select —', 'exzo' ); ?></option>
<?php foreach ( $menus as $menu ) : ?>
<option
value="<?php echo esc_attr( $menu->term_id ); ?>" <?php selected( $nav_menu, $menu->term_id ); ?>>
<?php echo esc_html( $menu->name ); ?>
</option>
<?php endforeach; ?>
</select>
</p>
<p><?php echo esc_html__( 'RIGHT MENU', 'exzo' ); ?></p>
<p>
<label
for="<?php echo esc_attr( $this->get_field_id( 'nav_menu2' ) ); ?>"><?php esc_html_e( 'Select Menu:', 'exzo' ); ?></label>
<select id="<?php echo esc_attr( $this->get_field_id( 'nav_menu2' ) ); ?>"
name="<?php echo esc_attr( $this->get_field_name( 'nav_menu2' ) ); ?>">
<option value="0"><?php esc_html_e( '— Select —', 'exzo' ); ?></option>
<?php foreach ( $menus2 as $menu2 ) : ?>
<option
value="<?php echo esc_attr( $menu2->term_id ); ?>" <?php selected( $nav_menu2, $menu2->term_id ); ?>>
<?php echo esc_html( $menu2->name ); ?>
</option>
<?php endforeach; ?>
</select>
</p>
</div>
<?php
}
}
class exzo_CATEGORIES_Wigdet_class extends WP_Widget {
/**
* Register the new widget
*/
function __construct() {
$args = array(
'name' => esc_html__( 'exzo CATEGORIES', 'exzo' ),
'description' => esc_html__( 'It displays a Categories list ', 'exzo' ),
'classname' => 'exzo_Search'
);
parent::__construct( 'exzo_Categories', 'exzo Categories', $args );
}
/**
* method to display in the admin
*
* @param $instance
*/
function form( $instance ) {
extract( $instance );
?>
<p>
<label
for="<?php echo esc_attr( esc_attr( $this->get_field_id( 'title' ) ) ); ?>"> <?php esc_html_e( 'Title:', 'exzo' ); ?></label>
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"
name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text"
value="<?php if ( isset( $title ) ) {
echo esc_attr( $title );
} else {
esc_html_e( 'QUECK LINKS', 'exzo' );
} ?>">
</p>
<?php
}
/**
* frontend for the site
*
* @param $args
* @param $instance
*/
function widget( $args, $instance ) {
extract( $args );
extract( $instance );
$title = sanitize_text_field( apply_filters( 'widget_title', $title ) );
?>
<?php
$title = sanitize_text_field( apply_filters( 'widget_title', $title ) );
echo wp_kses_post( $before_widget . "" );
echo wp_kses_post( $before_title ) . esc_attr( $title ) . wp_kses_post( $after_title ); ?>
<div class="footer-column-links">
<div class="row">
<?php // display categories in two columns
$categories = get_categories( '' );
$c = count( $categories );
$tota_left = ceil( $c / 2 );
?>
<div class="col-xs-6">
<?php
for ( $i = 0; $i <= $tota_left; $i ++ ) {
?>
<a href="<?php if ( isset ( $categories[ $i ]->term_id ) ) {
echo esc_url( get_category_link( $categories[ $i ]->term_id ) );
} ?>">
<?php if ( isset( $categories[ $i ] ) )
echo esc_html( $categories[ $i ]->name ) ?></a>
<?php
}
?>
</div>
<div class="col-xs-6">
<?php
for ( $j = $tota_left; $j <= $c; $j ++ ) {
?>
<a href="<?php echo esc_url( get_category_link( $categories[ $j ]->term_id ) ); ?>">
<?php if ( isset( $categories[ $j ] ) )
echo esc_html( $categories[ $j ]->name ) ?></a>
<?php
}
?>
</div>
</div>
</div>
<div class="clear visible-sm"></div>
<?php
echo wp_kses_post( $after_widget );
}
/*
* a method which, when the update of the widget is executed
*
* @param $new_instance
* @param $old_instance
* @return mixed
*/
function update( $new_instance, $old_instance ) {
$new_instance['title'] = ( ! empty( $new_instance['title'] ) && strlen( $new_instance['title'] ) > 1 ) ? esc_attr( $new_instance['title'] ) :
esc_html__( "CATEGORIES", 'exzo' );
return $new_instance;
}
}
class exzo_footer_info extends WP_Widget {
function __construct() {
$args = array(
'name' => esc_html__( 'exzo footer info', 'exzo' ),
'description' => esc_html__( 'It displays footer information', 'exzo' ),
'classname' => 'exzo_footer_info'
);
parent::__construct( 'exzo_footer_info', esc_html__( 'exzo footer_info', 'exzo' ), $args );
}
/**
* method to display in the admin
*
* @param $instance
*/
function form( $instance ) {
$instance = wp_parse_args(
(array) $instance,
array(
'copyright' => '©' . esc_html__( ' 2016 All Rights Reserved', 'exzo' ),
'text' => esc_html__( 'Cras sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.', 'exzo' ),
'logo' => esc_html__( 'NIGHT CITY', 'exzo' ),
)
);
extract( $instance );
?>
<p>
<label
for="<?php echo esc_attr( $this->get_field_id( 'logo' ) ); ?>"> <?php esc_html_e( 'Insert logo (image url):', 'exzo' ); ?></label>
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'logo' ) ); ?>"
name="<?php echo esc_attr( $this->get_field_name( 'logo' ) ); ?>" type="text"
value="<?php if ( isset( $logo ) ) {
echo esc_attr( $logo );
} ?>">
</p>
<p><label
for="<?php echo esc_attr( $this->get_field_id( 'text' ) ); ?>"><?php esc_html_e( 'Insert text:', 'exzo' ); ?></label>
<textarea class="widefat" rows="16" cols="20" id="<?php echo esc_attr( $this->get_field_id( 'text' ) ); ?>"
name="<?php echo esc_attr( $this->get_field_name( 'text' ) ); ?>"><?php echo wp_kses_post( $instance['text'] ); ?></textarea>
</p>
<p>
<label
for="<?php echo esc_attr( $this->get_field_id( 'phone' ) ); ?>"> <?php esc_html_e( ' Insert phone:', 'exzo' ); ?></label>
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'phone' ) ); ?>"
name="<?php echo esc_attr( $this->get_field_name( 'phone' ) ); ?>" type="text"
value="<?php if ( isset( $phone ) ) {
echo esc_attr( $phone );
} ?>">
</p>
<p>
<label
for="<?php echo esc_attr( $this->get_field_id( 'mail' ) ); ?>"> <?php esc_html_e( ' Insert mail:', 'exzo' ); ?></label>
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'mail' ) ); ?>"
name="<?php echo esc_attr( $this->get_field_name( 'mail' ) ); ?>" type="text"
value="<?php if ( isset( $mail ) ) {
echo esc_attr( $mail );
} ?>">
</p>
<p>
<label
for="<?php echo esc_attr( $this->get_field_id( 'contact' ) ); ?>"> <?php esc_html_e( ' Insert contact:', 'exzo' ); ?></label>
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'contact' ) ); ?>"
name="<?php echo esc_attr( $this->get_field_name( 'contact' ) ); ?>" type="text"
value="<?php if ( isset( $contact ) ) {
echo esc_attr( $contact );
} ?>">
</p>
<?php
}
/**
* frontend for the site
*
* @param $args
* @param $instance
*/
function widget( $args, $instance ) {
extract( $args );
$instance = wp_parse_args(
(array) $instance,
array(
'text' => esc_html__( 'Integer posuere orci sit amet feugiat pellent que. Suspendisse vel tempor justo, sit amet posuere orci dapibus auctor', 'exzo' ),
'logo' => '',
'mail' => esc_html__( 'office@exzo.com', 'exzo' ),
'phone' => esc_html__( '+3 (523) 555 123 8745', 'exzo' ),
'contact' => esc_html__( '1st, new york, usa', 'exzo' ),
)
);
extract( $instance );
?>
<div class="col-sm-6 col-md-3 col-xs-b30 col-md-b0">
<img src="<?php
echo esc_url( $logo ); ?>" alt=""/>
<div class="simple-article size-2 light fulltransparent"><?php echo wp_kses_post( $text ); ?></div>
<div class="footer-contact"><i class="fa fa-mobile"
aria-hidden="true"></i> <?php echo esc_html__( 'contact us: ', 'exzo' ); ?>
<a href="tel:+<?php echo esc_url( $phone ); ?>"><?php echo esc_html( $phone ); ?></a></div>
<div class="footer-contact"><i class="fa fa-envelope-o"
aria-hidden="true"></i> <?php echo esc_html__( 'email: ', 'exzo' ); ?> <a
href="mailto:<?php echo esc_url( $mail ); ?>"><?php echo esc_html( $mail ); ?></a></div>
<div class="footer-contact"><i class="fa fa-map-marker"
aria-hidden="true"></i> <?php echo esc_html__( 'address:', 'exzo' ); ?> <a
href="#"><?php echo esc_html( $contact ); ?></a></div>
</div>
<?php
}
}
class exzo_Recent_posts2 extends WP_Widget {
function __construct() {
$args = array(
'name' => esc_html__( 'exzo posts with small thumbnails', 'exzo' ),
'description' => esc_html__( 'It displays a list of posts', 'exzo' ),
'classname' => 'exzo_Recent_posts2'
);
parent::__construct( 'exzo_Recent_posts2', esc_html__( 'exzo Tweets2', 'exzo' ), $args );
}
/**
* method to display in the admin
*
* @param $instance
*/
function form( $instance ) {
$instance = wp_parse_args(
(array) $instance,
array(
'title' => esc_html__( 'SOME POSTS', 'exzo' ), // Legacy.
'text' => 3
)
);
extract( $instance );
?>
<p>
<label
for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"> <?php esc_html_e( 'Title:', 'exzo' ); ?></label>
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"
name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text"
value="<?php if ( isset( $title ) ) {
echo esc_attr( $title );
} ?>">
</p>
<p>
<label
for="<?php echo esc_attr( $this->get_field_id( 'text' ) ); ?>"> <?php esc_html_e( 'How many show post?',
'exzo' ); ?></label>
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'text' ) ); ?>"
name="<?php echo esc_attr( $this->get_field_name( 'text' ) ); ?>" type="text"
value="<?php
if ( isset( $text ) ) {
echo esc_attr( $text );
}
?>">
</p>
<?php
}
/**
* frontend for the site
*
* @param $args
* @param $instance
*/
function widget( $args, $instance ) {
extract( $args );
$instance = wp_parse_args(
(array) $instance,
array(
'title' => esc_html__( 'Recent posts', 'exzo' ), // Legacy.
'Name' => '',
'text' => 3
)
);
extract( $instance );
// Create a filter to the other plug-ins can change them
$title = sanitize_text_field( apply_filters( 'widget_title', $title ) );
$before_widget = str_replace( 'class="', 'class=" widget ', $before_widget );
echo wp_kses_post( $before_widget . "" );
if ( ! empty( $title ) ) {
echo wp_kses_post( $before_title ) . esc_attr( $title ) . wp_kses_post( $after_title );
$exzo_settings = get_exzo_settings();
if ( isset( $exzo_settings['exzo_rtl'] ) && $exzo_settings['exzo_rtl'] == true ) {
?>
<div class="empty-space col-xs-b20"></div>
<?php
}
}
$args = array(
'post_type' => 'post',
'post_status' => 'publish',
'posts_per_page' => $text,
'post__not_in' => get_option( 'sticky_posts' ),
'ignore_sticky_posts' => true,
'meta_query' => array( array( 'key' => '_thumbnail_id' ) )
);
?>
<?php
$exzo_blog_query = new WP_Query( $args );
if ( $exzo_blog_query->have_posts() ):
while ( $exzo_blog_query->have_posts() ) {
$exzo_blog_query->the_post();
?>
<div class="footer-post-preview clearfix">
<a class="image" href="#">
<?php the_post_thumbnail( 'exzo-image-70x60-croped' ); ?></a>
<div class="description">
<div class="date"><?php echo esc_html( get_the_date() ); ?></div>
<a href="<?php echo esc_url( get_the_permalink() ); ?>" class="title"><?php the_title(); ?></a>
</div>
</div>
<?php
}
wp_reset_postdata();
endif; ?>
<?php
echo wp_kses_post( $after_widget );
}
function update( $new_instance, $old_instance ) {
$new_instance['title'] = ! empty( $new_instance['title'] ) ? esc_attr( $new_instance['title'] ) :
esc_html__( 'Recent posts', 'exzo' );
$new_instance['text'] = ( (int) $new_instance['text'] ) ? $new_instance['text'] : 3;
return $new_instance;
}
}
//sidebar widget
class exzo_video extends WP_Widget {
function __construct() {
$args = array(
'name' => esc_html__( 'exzo Video', 'exzo' ),
'description' => esc_html__( 'It displays Video ', 'exzo' ),
'classname' => 'exzo_video'
);
parent::__construct( 'exzo_video', esc_html__( 'exzo Tweets2', 'exzo' ), $args );
}
/**
* method to display in the admin
*
* @param $instance
*/
function form( $instance ) {
$instance = wp_parse_args(
(array) $instance,
array(
'title' => esc_html__( 'YOUTUBE CHANEL', 'exzo' ), // Legacy.
'post_id' => '',
'text' => 3
)
);
extract( $instance );
?>
<p>
<label
for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"> <?php esc_html_e( 'Title:',
'exzo' ); ?></label>
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"
name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text"
value="<?php if ( isset( $title ) ) {
echo esc_attr( $title );
} ?>">
</p>
<p>
<label
for="<?php echo esc_attr( $this->get_field_id( 'text' ) ); ?>"> <?php esc_html_e( 'How many show post?',
'exzo' ); ?></label>
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'text' ) ); ?>"
name="<?php echo esc_attr( $this->get_field_name( 'text' ) ); ?>" type="text"
value="<?php
if ( isset( $text ) ) {
echo esc_attr( $text );
}
?>">
</p>
<p>
<label
for="<?php echo esc_attr( $this->get_field_id( 'post_id' ) ); ?>"> <?php esc_html_e( 'Insert posts ids, separated with comma.',
'exzo' ); ?></label>
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'post_id' ) ); ?>"
name="<?php echo esc_attr( $this->get_field_name( 'post_id' ) ); ?>" type="text"
value="<?php
if ( isset( $post_id ) ) {
echo esc_attr( $post_id );
}
?>">
</p>
<?php
}
/**
* frontend for the site
*
* @param $args
* @param $instance
*/
function widget( $args, $instance ) {
extract( $args );
$instance = wp_parse_args(
(array) $instance,
array(
'title' => esc_html__( 'Recent posts', 'exzo' ), // Legacy.
'Name' => '',
'text' => 3,
'post_id' => '',
)
);
extract( $instance );
// Create a filter to the other plug-ins can change them
$title = sanitize_text_field( apply_filters( 'widget_title', $title ) );
$before_widget = str_replace( 'class="', 'class=" widget ', $before_widget );
echo wp_kses_post( $before_widget . "" );
?>
<?php
echo wp_kses_post( $before_title ) . esc_attr( $title ) . wp_kses_post( $after_title );
$myarray = array();
$myarray = explode( ',', $post_id );
$args = array(
'posts_per_page' => $text,
'post_type' => 'post',
'post_status' => 'publish',
'post__not_in' => get_option( 'sticky_posts' ),
'ignore_sticky_posts' => true,
'meta_query' => array( array( 'key' => '_thumbnail_id' ) )
);
if ( isset( $post_id{1} ) ) {
$args['post__in'] = $myarray;
$args['orderby'] = 'post__in';
} else {
$args['orderby'] = 'date';
}
$args ['tax_query'] = array(
'relation' => 'OR',
array(
'taxonomy' => 'category',
'field' => 'slug',
'terms' => array( 'post' )
),
array(
'taxonomy' => 'post_format',
'field' => 'slug',
'terms' => array( 'post-format-video' )
)
);
?>
<div class="swiper-container" data-breakpoints="1" data-xs-slides="1" data-sm-slides="2" data-md-slides="1"
data-lt-slides="1" data-slides-per-view="1" data-space="30">
<div class="swiper-button-prev hidden"></div>
<div class="swiper-button-next hidden"></div>
<div class="swiper-wrapper">
<?php
$exzo_blog_query = new WP_Query( $args );
if ( $exzo_blog_query->have_posts() ):
while ( $exzo_blog_query->have_posts() ) {
$exzo_blog_query->the_post();
?>
<div class="swiper-slide">
<div class="blog-shortcode style-2">
<a class="preview rounded-image">
<?php the_post_thumbnail( 'exzo-image-848x438-croped', array( 'class' => 'rounded-image' ) ); ?>
<span class="play-button open-video"
data-src="<?php echo exzo_theme_get_video_url(); ?>">
</span>
</a>
<div class="title h6"><a
href="<?php echo esc_url( get_the_permalink() ); ?>"><?php the_title(); ?></a>
</div>
<div
class="description simple-article size-1 grey widget_filter "><?php echo wp_kses_post( exzo_limit_excerpt( exzo_words_limit() ) ); ?></div>
</div>
</div>
<?php
}
wp_reset_postdata();
endif; ?>
</div>
<div class="swiper-pagination relative-pagination-small"></div>
</div>
<?php
echo wp_kses_post( $after_widget );
}
function update( $new_instance, $old_instance ) {
$new_instance['title'] = ! empty( $new_instance['title'] ) ? esc_attr( $new_instance['title'] ) :
esc_html__( 'Recent posts', 'exzo' );
$new_instance['text'] = ( (int) $new_instance['text'] ) ? $new_instance['text'] : 3;
//$new_instance['post_id'] = !empty( $new_instance['post_id'] ) ;
return $new_instance;
}
}
//sidebar widget
class exzo_Recent_posts extends WP_Widget {
function __construct() {
$args = array(
'name' => esc_html__( 'exzo Recent posts', 'exzo' ),
'description' => esc_html__( 'It displays a list of tweets', 'exzo' ),
'classname' => 'exzo_Recent_posts'
);
parent::__construct( 'exzo_Recent_posts', esc_html__( 'exzo Tweets2', 'exzo' ), $args );
}
/**
* method to display in the admin
*
* @param $instance
*/
function form( $instance ) {
$instance = wp_parse_args(
(array) $instance,
array(
'title' => esc_html__( 'Recent posts', 'exzo' ), // Legacy.
'text' => 3
)
);
extract( $instance );
?>
<p>
<label
for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"> <?php esc_html_e( 'Title:',
'exzo' ); ?></label>
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"
name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text"
value="<?php if ( isset( $title ) ) {
echo esc_attr( $title );
} ?>">
</p>
<p>
<label
for="<?php echo esc_attr( $this->get_field_id( 'text' ) ); ?>"> <?php esc_html_e( 'How many show post?',
'exzo' ); ?></label>
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'text' ) ); ?>"
name="<?php echo esc_attr( $this->get_field_name( 'text' ) ); ?>" type="text"
value="<?php
if ( isset( $text ) ) {
echo esc_attr( $text );
}
?>">
</p>
<?php
}
/**
* frontend for the site
*
* @param $args
* @param $instance
*/
function widget( $args, $instance ) {
extract( $args );
$instance = wp_parse_args(
(array) $instance,
array(
'title' => esc_html__( 'Recent posts', 'exzo' ), // Legacy.
'Name' => '',
'text' => 3
)
);
extract( $instance );
// Create a filter to the other plug-ins can change them
$title = sanitize_text_field( apply_filters( 'widget_title', $title ) );
$before_widget = str_replace( 'class="', 'class=" widget ', $before_widget );
echo wp_kses_post( $before_widget . "" );
?>
<?php
echo wp_kses_post( $before_title ) . esc_attr( $title ) . wp_kses_post( $after_title );
$args = array(
'post_type' => 'post',
'orderby' => 'date',
'post_status' => 'publish',
'posts_per_page' => $text,
'post__not_in' => get_option( 'sticky_posts' ),
'ignore_sticky_posts' => true,
'meta_query' => array( array( 'key' => '_thumbnail_id' ) )
);
?>
<div class="blog-shortcode style-2">
<?php
$exzo_blog_query = new WP_Query( $args );
if ( $exzo_blog_query->have_posts() ):
while ( $exzo_blog_query->have_posts() ) {
$exzo_blog_query->the_post();
?>
<a href="<?php echo esc_url( get_the_permalink() ); ?>"
class="preview rounded-image simple-mouseover">
<?php the_post_thumbnail( 'exzo-image-263x185', array( 'class' => 'rounded-image' ) ); ?>
</a>
<div class="title h6"><a
href="<?php echo esc_url( get_the_permalink() ); ?>"><?php the_title(); ?></a></div>
<div
class="description simple-article size-1 grey uppercase"><?php echo esc_html( get_the_date() ); ?>
<a class="color"
href="<?php echo esc_url( get_the_author_link() ); ?>"><?php echo esc_html( get_the_author() ); ?></a>
<?php exzo_get_list_cats(); ?>
</div>
<div class="empty-space col-xs-b25"></div>
<?php
}
wp_reset_postdata();
endif; ?>
</div>
<?php
echo wp_kses_post( $after_widget );
}
function update( $new_instance, $old_instance ) {
$new_instance['title'] = ! empty( $new_instance['title'] ) ? esc_attr( $new_instance['title'] ) :
esc_html__( 'Recent posts', 'exzo' );
$new_instance['text'] = ( (int) $new_instance['text'] ) ? $new_instance['text'] : 3;
return $new_instance;
}
}
class exzo_Widget_Product_Tag_Cloud extends WP_Widget {
function __construct() {
$args = array(
'name' => esc_html__( 'exzo TAG Cloud', 'exzo' ),
'description' => esc_html__( 'Your most used tags in cloud format.', 'exzo' ),
'classname' => 'widget-tag-product-cloud'
);
parent::__construct( 'widget-product-tag-cloud', esc_html__( 'exzo TAG Cloud', 'exzo' ), $args );
}
/**
* method to display in the admin
*
* @param $instance
*/
function form( $instance ) {
$instance = wp_parse_args( (array) $instance,
array(
'title' => esc_html__( 'POPULAR TAGS', 'exzo' ),
'type_tag' => '0',
'number' => 10,
'taxonomy' => '',
'filter' => '',
) );
extract( $instance );
$title = sanitize_text_field( $instance['title'] );
?>
<p><label
for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php esc_html_e( 'Title:', 'exzo' ); ?></label>
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"
name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>"
type="text" value="<?php echo esc_attr( $title ); ?>"/></p>
<p>
<p><input id="<?php echo esc_attr( $this->get_field_id( 'filter' ) ); ?>"
name="<?php echo esc_attr( $this->get_field_name( 'filter' ) ); ?>"
type="checkbox"<?php checked( $filter ); ?> /> <label
for="<?php echo esc_attr( $this->get_field_id( 'filter' ) ); ?>"><?php esc_html_e( 'Tags light background', 'exzo' ); ?></label>
</p>
<p><input id="<?php echo esc_attr( $this->get_field_id( 'taxonomy' ) ); ?>"
name="<?php echo esc_attr( $this->get_field_name( 'taxonomy' ) ); ?>"
type="checkbox"<?php checked( $taxonomy ); ?> /> <label
for="<?php echo esc_attr( $this->get_field_id( 'taxonomy' ) ); ?>"><?php esc_html_e( 'Shop tags', 'exzo' ); ?></label>
</p>
<?php
}
/**
* frontend for the site
*
* @param $args
* @param $instance
*/
public function widget( $args, $instance ) {
/** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */
extract( $args );
$instance = wp_parse_args(
(array) $instance,
array(
'filter' => '',
'taxonomy' => '',
)
);
extract( $instance );
$title = apply_filters( 'widget_title', empty( $instance['title'] ) ? esc_html__( 'Tags', 'exzo' ) : $instance['title'], $instance, $this->id_base );
echo wp_kses_post( $before_widget );
if ( ! empty( $title ) ) {
echo wp_kses_post( $before_title ) . esc_attr( $title ) . wp_kses_post( $after_title );
$exzo_settings = get_exzo_settings();
if ( isset( $exzo_settings['exzo_rtl'] ) && $exzo_settings['exzo_rtl'] == true ) {
?>
<div class="empty-space col-xs-b20"></div>
<?php
}
}
$color = 'light';
?>
<div class="tags shop-tags clearfix <?php if ( ! empty( $instance['filter'] ) ) {
echo esc_attr( $color );
} ?> ">
<?php
if ( ! empty( $instance['taxonomy'] ) ) {
$post_type = 'product_tag';
} else {
$post_type = 'post_tag';
}
$args = array(
'smallest' => 9
,
'largest' => 9
,
'unit' => 'px'
,
'number' => 45
,
'format' => 'array'
,
'separator' => "\n"
,
'orderby' => 'name'
,
'order' => 'ASC'
,
'taxonomy' => $post_type
,
'echo' => false
);
$posttags = wp_tag_cloud( $args );
if ( $posttags ) {
foreach ( $posttags as $tag ) {
echo wp_kses_post( $tag );
}
}
?>
</div>
<?php
echo wp_kses_post( $after_widget );
$exzo_settings = get_exzo_settings();
if ( isset( $exzo_settings['exzo_rtl'] ) && $exzo_settings['exzo_rtl'] == true ) {
?>
<div class="empty-space col-xs-b25 col-sm-b50"></div>
<?php
}
}
public function update( $new_instance, $old_instance ) {
$instance = $old_instance;
$new_instance = wp_parse_args( (array) $new_instance, array(
'title' => '',
'count' => 0,
'dropdown' => ''
) );
$instance['title'] = sanitize_text_field( $new_instance['title'] );
$instance['number'] = $new_instance['number'] ? (int) sanitize_title( $new_instance['number'] ) : 10;
$instance['type_tag'] = $new_instance['type_tag'] ? (int) sanitize_title( $new_instance['type_tag'] ) : '0';
$instance['filter'] = ! empty( $new_instance['filter'] );
$instance['taxonomy'] = ! empty( $new_instance['taxonomy'] );
return $instance;
}
/*********** End New**************/
}
class exzo_custom_product_2_class extends WP_Widget {
function __construct() {
$args = array(
'name' => esc_html__( 'exzo product list', 'exzo' ),
'description' => esc_html__( 'product list', 'exzo' ),
'classname' => 'exzo_widget-product-list'
);
parent::__construct( 'exzo_widget-product-list', esc_html__( 'exzo TAG Cloud', 'exzo' ), $args );
}
/**
* method to display in the admin
*
* @param $instance
*/
function form( $instance ) {
// PART 1: Extract the data from the instance variable
$instance = wp_parse_args( (array) $instance, array( 'title' => '' ) );
$instance = wp_parse_args( (array) $instance,
array(
'title' => esc_html__( 'POPULAR TAGS', 'exzo' ),
'number' => '3',
'type' => '1',
) );
extract( $instance );
$title = sanitize_text_field( $instance['title'] );
?>
<p><label
for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php esc_html_e( 'Title:', 'exzo' ); ?></label>
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"
name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>"
type="text" value="<?php echo esc_attr( $title ); ?>"/></p>
<p>
<!-- PART 3: Widget City field START -->
<p>
<label for="<?php echo esc_attr( $this->get_field_id( 'type' ) ); ?>"> <?php esc_html_e( 'Select type product', 'exzo' ); ?>
<select class='widefat' id="<?php echo esc_attr( $this->get_field_id( 'type' ) ); ?>"
name="<?php echo esc_attr( $this->get_field_name( 'type' ) ); ?>" type="text">
<option value='1' <?php echo ( $type == '1' ) ? 'selected' : ''; ?>>
<?php esc_html_e( 'HOT SALE', 'exzo' ); ?>
</option>
<option value='2' <?php echo ( $type == '2' ) ? 'selected' : ''; ?>>
<?php esc_html_e( 'TOP RATED', 'exzo' ); ?>
</option>
<option value='3' <?php echo ( $type == '3' ) ? 'selected' : ''; ?>>
<?php esc_html_e( 'POPULAR', 'exzo' ); ?>
</option>
<option value='4' <?php echo ( $type == '4' ) ? 'selected' : ''; ?>>
<?php esc_html_e( 'BEST CHOICE', 'exzo' ); ?>
</option>
</select>
</label>
</p>
<p>
<label
for="<?php echo esc_attr( $this->get_field_id( 'number' ) ); ?>"><?php esc_html_e( 'number:', 'exzo' ); ?></label>
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'number' ) ); ?>"
name="<?php echo esc_attr( $this->get_field_name( 'number' ) ); ?>"
type="text" value="<?php echo esc_attr( $number ); ?>"/></p>
<p>
<!-- Widget City field END -->
<?php
}
/**
* @param array $new_instance
* @param array $old_instance
*
* @return array
*/
public function update( $new_instance, $old_instance ) {
$instance = $old_instance;
$new_instance = wp_parse_args( (array) $new_instance,
array(
'title' => esc_html__( 'POPULAR TAGS', 'exzo' ),
'number' => '3',
'type' => '1',
) );
$instance['title'] = sanitize_text_field( $new_instance['title'] );
$instance['number'] = $new_instance['number'] ? (int) sanitize_title( $new_instance['number'] ) : 10;
$instance['type'] = $new_instance['type'] ? (int) sanitize_title( $new_instance['type'] ) : '1';
return $instance;
}
/**
* frontend for the site
*
* @param $args
* @param $instance
*/
public function widget( $args, $instance ) {
/** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */
extract( $args );
$instance = wp_parse_args(
(array) $instance,
array(
'title' => esc_html__( 'POPULAR TAGS', 'exzo' ),
'number' => '3',
'type' => '1',
)
);
extract( $instance );
$title = apply_filters( 'widget_title', empty( $instance['title'] ) ? esc_html__( 'Tags', 'exzo' ) : $instance['title'], $instance, $this->id_base );
echo wp_kses_post( $before_widget );
echo wp_kses_post( $before_title ) . esc_attr( $title ) . wp_kses_post( $after_title );
$color = 'light';
?>
<?php
if ( $type === 1 ) {
$args = array(
'post_type' => 'product',
'orderby' => 'name',
'post_status' => 'publish',
'posts_per_page' => 3,
);
$args['orderby'] = 'meta_value_num';
$args['order'] = 'DESC';
$args['meta_key'] = 'total_sales';
} elseif ( $type === 2 ) {
$args = array(
'post_type' => 'product',
'orderby' => 'name',
'post_status' => 'publish',
'posts_per_page' => 3,
);
$args['orderby'] = 'meta_value_num';
$args['order'] = 'DESC';
$args['meta_key'] = '_wc_average_rating';
} elseif ( $type === 3 ) {
$args = array(
'post_type' => 'product',
'orderby' => 'date',
'post_status' => 'publish',
'posts_per_page' => 3,
'meta_key' => 'total_sales',
);
} else {
$args = array(
'post_type' => 'product',
'post_status' => 'publish',
'posts_per_page' => 3,
'orderby' => 'price',
'order' => 'asc'
);
}
$args['post__not_in'] = array( 2114 );
$args['meta_query'] = array(
array(
'key' => '_thumbnail_id',
'compare' => 'EXISTS'
),
);
$rent_blog_query = new WP_Query( $args );
if ( $rent_blog_query->have_posts() ):
while ( $rent_blog_query->have_posts() ) {
$rent_blog_query->the_post();
?>
<div class="product-shortcode style-4 rounded clearfix">
<a class="preview" href="<?php echo esc_url( get_the_permalink() ); ?>">
<?php the_post_thumbnail( 'exzo-image-92x92' ); ?>
</a>
<div class="description">
<div class="simple-article color size-1 col-xs-b5"><?php exzo_get_list_cats(); ?></div>
<h6 class="h6 col-xs-b10"><a
href="<?php echo esc_url( get_the_permalink() ); ?>"><?php the_title(); ?></a></h6>
<div
class="simple-article dark"><?php echo wp_kses_post( exzo_get_formatted_price() ); ?>
</div>
</div>
</div>
<div class="col-xs-b10"></div>
<?php
}
wp_reset_postdata();
endif; ?>
<?php
echo wp_kses_post( $after_widget );
}
/*********** End New**************/
}