'business_era_widget_social', 'description' => esc_html__( 'Social Icons Widget', 'business-era' ), ); parent::__construct( 'business-era-social', esc_html__( 'Business Era: Social', 'business-era' ), $opts ); } /** * Echo the widget content. * * @since 1.0.0 * * @param array $args Display arguments including before_title, after_title, * before_widget, and after_widget. * @param array $instance The settings for the particular instance of the widget. */ function widget( $args, $instance ) { $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base ); echo $args['before_widget']; if ( ! empty( $title ) ) { echo $args['before_title'] . $title . $args['after_title']; } if ( has_nav_menu( 'social' ) ) { wp_nav_menu( array( 'theme_location' => 'social', 'link_before' => '', 'link_after' => '', ) ); } echo $args['after_widget']; } /** * Update widget instance. * * @since 1.0.0 * * @param array $new_instance New settings for this instance as input by the user via * {@see WP_Widget::form()}. * @param array $old_instance Old settings for this instance. * @return array Settings to save or bool false to cancel saving. */ function update( $new_instance, $old_instance ) { $instance = $old_instance; $instance['title'] = sanitize_text_field( $new_instance['title'] ); return $instance; } /** * Output the settings update form. * * @since 1.0.0 * * @param array $instance Current settings. */ function form( $instance ) { $instance = wp_parse_args( (array) $instance, array( 'title' => '', ) ); ?>
'business_era_widget_latest_news', 'description' => __( 'Latest News Widget', 'business-era' ), ); parent::__construct( 'business-era-latest-news', esc_html__( 'Business Era: Latest News', 'business-era' ), $opts ); } function widget( $args, $instance ) { $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base ); $post_category = ! empty( $instance['post_category'] ) ? $instance['post_category'] : 0; $post_column = ! empty( $instance['post_column'] ) ? $instance['post_column'] : 4; $featured_image = ! empty( $instance['featured_image'] ) ? $instance['featured_image'] : 'medium'; $post_number = ! empty( $instance['post_number'] ) ? $instance['post_number'] : 4; $excerpt_length = !empty( $instance['excerpt_length'] ) ? $instance['excerpt_length'] : 10; $enable_excerpt = ! empty( $instance['enable_excerpt'] ) ? $instance['enable_excerpt'] : 0; echo $args['before_widget']; echo '
'name', 'hide_empty' => 0, 'taxonomy' => 'category', 'name' => $this->get_field_name( 'post_category' ), 'id' => $this->get_field_id( 'post_category' ), 'class' => 'widefat', 'selected' => absint( $instance['post_category'] ), 'show_option_all' => __( 'All Categories','business-era' ), ); wp_dropdown_categories( $cat_args ); ?>
dropdown_post_columns( array( 'id' => $this->get_field_id( 'post_column' ), 'name' => $this->get_field_name( 'post_column' ), 'selected' => absint( $instance['post_column'] ), ) ); ?>
dropdown_image_sizes( array( 'id' => $this->get_field_id( 'featured_image' ), 'name' => $this->get_field_name( 'featured_image' ), 'selected' => esc_attr( $instance['featured_image'] ), ) ); ?>
id="get_field_id( 'enable_excerpt' ); ?>" name="get_field_name( 'enable_excerpt' ); ?>" />
'', 'name' => '', 'selected' => 0, ); $r = wp_parse_args( $args, $defaults ); $output = ''; $choices = array( '2' => 2, '3' => 3, '4' => 4, ); if ( ! empty( $choices ) ) { $output = "\n"; } echo $output; } function dropdown_image_sizes( $args ) { $defaults = array( 'id' => '', 'class' => 'widefat', 'name' => '', 'selected' => 0, ); $r = wp_parse_args( $args, $defaults ); $output = ''; $choices = array( 'business-era-blog' => esc_html__( 'Business Era Custom', 'business-era' ), 'thumbnail' => esc_html__( 'Thumbnail', 'business-era' ), 'medium' => esc_html__( 'Medium', 'business-era' ), 'large' => esc_html__( 'Large', 'business-era' ), 'full' => esc_html__( 'Full', 'business-era' ), ); if ( ! empty( $choices ) ) { $output = "\n"; } echo $output; } } endif; if ( ! class_exists( 'Business_Era_CTA_Widget' ) ) : /** * CTA widget class. * * @since 1.0.0 */ class Business_Era_CTA_Widget extends WP_Widget { /** * Constructor. * * @since 1.0.0 */ function __construct() { $opts = array( 'classname' => 'business_era_widget_call_to_action', 'description' => esc_html__( 'Call To Action Widget', 'business-era' ), ); parent::__construct( 'business-era-cta', esc_html__( 'Business Era: CTA', 'business-era' ), $opts ); } /** * Echo the widget content. * * @since 1.0.0 * * @param array $args Display arguments including before_title, after_title, * before_widget, and after_widget. * @param array $instance The settings for the particular instance of the widget. */ function widget( $args, $instance ) { $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base ); $text = ! empty( $instance['text'] ) ? $instance['text'] : ''; $button_text = ! empty( $instance['button_text'] ) ? esc_html( $instance['button_text'] ) : ''; $button_url = ! empty( $instance['button_url'] ) ? esc_url( $instance['button_url'] ) : ''; echo $args['before_widget']; echo '
'business_era_widget_advance_call_to_action', 'description' => esc_html__( 'Advance Call To Action Widget with multiple buttons and background image', 'business-era' ), ); parent::__construct( 'business-era-advance-cta', esc_html__( 'Business Era: Advance CTA', 'business-era' ), $opts ); } /** * Echo the widget content. * * @since 1.0.0 * * @param array $args Display arguments including before_title, after_title, * before_widget, and after_widget. * @param array $instance The settings for the particular instance of the widget. */ function widget( $args, $instance ) { $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base ); $text = ! empty( $instance['text'] ) ? $instance['text'] : ''; $button_text = ! empty( $instance['button_text'] ) ? esc_html( $instance['button_text'] ) : ''; $button_url = ! empty( $instance['button_url'] ) ? esc_url( $instance['button_url'] ) : ''; $button_two_text = ! empty( $instance['button_two_text'] ) ? esc_html( $instance['button_two_text'] ) : ''; $button_two_url = ! empty( $instance['button_two_url'] ) ? esc_url( $instance['button_two_url'] ) : ''; $bg_pic = ! empty( $instance['bg_pic'] ) ? esc_url_raw( $instance['bg_pic'] ) : ''; // Add background image. if ( ! empty( $bg_pic ) ) { $background_style = ''; $background_style .= ' style="background-image:url(' . esc_url( $bg_pic ) . ');" '; $args['before_widget'] = implode( $background_style . ' ' . 'class="with_bg ', explode( 'class="', $args['before_widget'], 2 ) ); } echo $args['before_widget']; echo '
id="get_field_id( 'detail_link' ); ?>" name="get_field_name( 'detail_link' ); ?>" />
$this->get_field_id( "item_id_$i" ), 'class' => 'widefat', 'name' => $this->get_field_name( "item_id_$i" ), 'selected' => $instance["item_id_$i"], 'show_option_none' => esc_html__( '— Select —', 'business-era' ), ) ); ?>
" name="get_field_name( "item_icon_$i" ) ); ?>" type="text" value="" />
'business_era_widget_page', 'description' => __( 'Display page and its featured image.', 'business-era' ), ); parent::__construct( 'business-era-page', __( 'Business Era: Page', 'business-era' ), $opts ); } function widget( $args, $instance ) { $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base ); $page_id = ! empty( $instance['page_id'] ) ? absint( $instance['page_id'] ) : ''; $img_position = ! empty( $instance['img_position'] ) ? sanitize_text_field( $instance['img_position'] ) : ''; echo $args['before_widget']; echo '
$this->get_field_id( "page_id" ), 'class' => 'widefat', 'name' => $this->get_field_name( "page_id" ), 'selected' => $instance["page_id"], 'show_option_none' => esc_html__( '— Select —', 'business-era' ), ) ); ?>