'business_point_widget_social', 'description' => esc_html__( 'Social Icons Widget', 'business-point' ), ); parent::__construct( 'business-point-social', esc_html__( 'BP: Social', 'business-point' ), $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'] . esc_html( $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. * @return void */ function form( $instance ) { $instance = wp_parse_args( (array) $instance, array( 'title' => '', ) ); ?>
'business_point_widget_latest_news', 'description' => esc_html__( 'Latest News Widget', 'business-point' ), ); parent::__construct( 'business-point-latest-news', esc_html__( 'BP: Latest News', 'business-point' ), $opts ); } function widget( $args, $instance ) { $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base ); $section_icon = !empty( $instance['section_icon'] ) ? $instance['section_icon'] : ''; $sub_title = !empty( $instance['sub_title'] ) ? $instance['sub_title'] : ''; $post_category = ! empty( $instance['post_category'] ) ? $instance['post_category'] : 0; $exclude_categories = !empty( $instance[ 'exclude_categories' ] ) ? esc_attr( $instance[ 'exclude_categories' ] ) : ''; $layout_type = !empty( $instance[ 'layout_type' ] ) ? esc_attr( $instance[ 'layout_type' ] ) : ''; $posts_to_show = !empty( $instance[ 'posts_to_show' ] ) ? esc_attr( $instance[ 'posts_to_show' ] ) : ''; $disable_date = ! empty( $instance['disable_date'] ) ? $instance['disable_date'] : 0; echo $args['before_widget']; ?> '', 'section_icon' => 'fa-folder-open-o', 'sub_title' => '', 'post_category' => '', 'exclude_categories' => '', 'disable_date' => 0, 'layout_type' => 'layout-1', 'posts_to_show' => 6, ) ); ?>
'name', 'hide_empty' => 0, 'class' => 'widefat', 'taxonomy' => 'category', 'name' => $this->get_field_name( 'post_category' ), 'id' => $this->get_field_id( 'post_category' ), 'selected' => absint( $instance['post_category'] ), 'show_option_all' => esc_html__( 'All Categories','business-point' ), ); wp_dropdown_categories( $cat_args ); ?>
dropdown_layout_type( array( 'id' => $this->get_field_id( 'layout_type' ), 'name' => $this->get_field_name( 'layout_type' ), 'selected' => esc_attr( $instance['layout_type'] ), ) ); ?>
id="get_field_id( 'disable_date' ); ?>" name="get_field_name( 'disable_date' ); ?>" />
'', 'name' => '', 'selected' => 'layout-1', ); $r = wp_parse_args( $args, $defaults ); $output = ''; $choices = array( 'layout-1' => esc_html__( 'Layout One', 'business-point' ), 'layout-2' => esc_html__( 'Layout Two', 'business-point' ), ); if ( ! empty( $choices ) ) { $output = "\n"; } echo $output; } } endif; if ( ! class_exists( 'Business_Point_CTA_Widget' ) ) : /** * CTA widget class. * * @since 1.0.0 */ class Business_Point_CTA_Widget extends WP_Widget { /** * Constructor. * * @since 1.0.0 */ function __construct() { $opts = array( 'classname' => 'business_point_widget_call_to_action', 'description' => esc_html__( 'Call To Action Widget', 'business-point' ), ); parent::__construct( 'business-point-cta', esc_html__( 'BP: CTA', 'business-point' ), $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 ); $cta_page = !empty( $instance['cta_page'] ) ? $instance['cta_page'] : ''; $button_text = ! empty( $instance['button_text'] ) ? esc_html( $instance['button_text'] ) : ''; $button_url = ! empty( $instance['button_url'] ) ? esc_url( $instance['button_url'] ) : ''; $secondary_button_text = ! empty( $instance['secondary_button_text'] ) ? esc_html( $instance['secondary_button_text'] ) : ''; $secondary_button_url = ! empty( $instance['secondary_button_url'] ) ? esc_url( $instance['secondary_button_url'] ) : ''; $bg_pic = ! empty( $instance['bg_pic'] ) ? esc_url( $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="bg_enabled ', explode( 'class="', $args['before_widget'], 2 ) ); } echo $args['before_widget']; ?> '', 'cta_page' => '', 'button_text' => esc_html__( 'Find More', 'business-point' ), 'button_url' => '', 'secondary_button_text' => esc_html__( 'Buy Now', 'business-point' ), 'secondary_button_url' => '', 'bg_pic' => '', ) ); $bg_pic = ''; if ( ! empty( $instance['bg_pic'] ) ) { $bg_pic = $instance['bg_pic']; } $wrap_style = ''; if ( empty( $bg_pic ) ) { $wrap_style = ' style="display:none;" '; } $image_status = false; if ( ! empty( $bg_pic ) ) { $image_status = true; } $delete_button = 'display:none;'; if ( true === $image_status ) { $delete_button = 'display:inline-block;'; } ?>
$this->get_field_id( 'cta_page' ), 'class' => 'widefat', 'name' => $this->get_field_name( 'cta_page' ), 'selected' => $instance[ 'cta_page' ], 'show_option_none' => esc_html__( '— Select —', 'business-point' ), ) ); ?>
" name="get_field_name( "item_icon_$i" ) ); ?>" type="text" value="" />
$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-point' ), ) ); ?>
'business_point_widget_newsletter', 'description' => esc_html__( 'Newsletter with mailchimp form', 'business-point' ), ); parent::__construct( 'business-point-newsletter', esc_html__( 'BP: Newsletter', 'business-point' ), $opts ); } function widget( $args, $instance ) { $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base ); $section_icon = !empty( $instance['section_icon'] ) ? $instance['section_icon'] : ''; $sub_title = !empty( $instance['sub_title'] ) ? $instance['sub_title'] : ''; $newsletter_shortcode = !empty( $instance['newsletter_shortcode'] ) ? $instance['newsletter_shortcode'] : ''; $overlay_type = !empty( $instance['overlay_type'] ) ? $instance['overlay_type'] : ''; $bg_pic = ! empty( $instance['bg_pic'] ) ? esc_url( $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="overlay-'.esc_html( $overlay_type ).' bg_enabled ', explode( 'class="', $args['before_widget'], 2 ) ); } echo $args['before_widget']; ?> '', 'section_icon' => 'fa-envelope-o', 'sub_title' => '', 'newsletter_shortcode' => '', 'overlay_type' => 'light', 'bg_pic' => '', ); $instance = wp_parse_args( (array) $instance, $defaults ); $newsletter_shortcode = !empty( $instance['newsletter_shortcode'] ) ? $instance['newsletter_shortcode'] : ''; $bg_pic = ''; if ( ! empty( $instance['bg_pic'] ) ) { $bg_pic = $instance['bg_pic']; } $wrap_style = ''; if ( empty( $bg_pic ) ) { $wrap_style = ' style="display:none;" '; } $image_status = false; if ( ! empty( $bg_pic ) ) { $image_status = true; } $delete_button = 'display:none;'; if ( true === $image_status ) { $delete_button = 'display:inline-block;'; } ?>
dropdown_overlay_type( array( 'id' => $this->get_field_id( 'overlay_type' ), 'name' => $this->get_field_name( 'overlay_type' ), 'selected' => esc_attr( $instance['overlay_type'] ), ) ); ?>