'bizroot_widget_social', 'description' => __( 'Displays social icons.', 'bizroot' ), 'customize_selective_refresh' => true, ); $fields = array( 'title' => array( 'label' => __( 'Title:', 'bizroot' ), 'type' => 'text', 'class' => 'widefat', ), 'subtitle' => array( 'label' => __( 'Subtitle:', 'bizroot' ), 'type' => 'text', 'class' => 'widefat', ), ); if ( false === has_nav_menu( 'social' ) ) { $fields['message'] = array( 'label' => __( 'Social menu is not set. Please create menu and assign it to Social Menu.', 'bizroot' ), 'type' => 'message', 'class' => 'widefat', ); } parent::__construct( 'bizroot-social', __( 'Bizroot: Social', 'bizroot' ), $opts, array(), $fields ); } /** * Outputs the content for the current widget instance. * * @since 1.0.0 * * @param array $args Display arguments. * @param array $instance Settings for the current widget instance. */ function widget( $args, $instance ) { $params = $this->get_params( $instance ); echo $args['before_widget']; if ( ! empty( $params['title'] ) ) { echo $args['before_title'] . $params['title'] . $args['after_title']; } if ( ! empty( $params['subtitle'] ) ) { echo '
'; } if ( has_nav_menu( 'social' ) ) { wp_nav_menu( array( 'theme_location' => 'social', 'container' => false, 'depth' => 1, 'link_before' => '', 'link_after' => '', 'item_spacing' => 'discard', ) ); } echo $args['after_widget']; } } endif; if ( ! class_exists( 'Bizroot_Latest_News_Widget' ) ) : /** * Latest news widget Class. * * @since 1.0.0 */ class Bizroot_Latest_News_Widget extends Bizroot_Widget_Base { /** * Sets up a new widget instance. * * @since 1.0.0 */ function __construct() { $opts = array( 'classname' => 'bizroot_widget_latest_news', 'description' => __( 'Displays latest posts in grid.', 'bizroot' ), 'customize_selective_refresh' => true, ); $fields = array( 'title' => array( 'label' => __( 'Title:', 'bizroot' ), 'type' => 'text', 'class' => 'widefat', ), 'subtitle' => array( 'label' => __( 'Subtitle:', 'bizroot' ), 'type' => 'text', 'class' => 'widefat', ), 'post_category' => array( 'label' => __( 'Select Category:', 'bizroot' ), 'type' => 'dropdown-taxonomies', 'show_option_all' => __( 'All Categories', 'bizroot' ), ), 'post_number' => array( 'label' => __( 'Number of Posts:', 'bizroot' ), 'type' => 'number', 'default' => 3, 'css' => 'max-width:60px;', 'min' => 1, 'max' => 100, ), 'post_column' => array( 'label' => __( 'Number of Columns:', 'bizroot' ), 'type' => 'select', 'default' => 3, 'options' => bizroot_get_numbers_dropdown_options( 1, 4 ), ), 'featured_image' => array( 'label' => __( 'Featured Image:', 'bizroot' ), 'type' => 'select', 'default' => 'bizroot-thumb', 'options' => bizroot_get_image_sizes_options(), ), 'excerpt_length' => array( 'label' => __( 'Excerpt Length:', 'bizroot' ), 'description' => __( 'in words', 'bizroot' ), 'type' => 'number', 'css' => 'max-width:60px;', 'default' => 15, 'min' => 1, 'max' => 400, 'adjacent' => true, ), 'more_text' => array( 'label' => __( 'More Text:', 'bizroot' ), 'type' => 'text', 'default' => __( 'Read more', 'bizroot' ), ), 'disable_date' => array( 'label' => __( 'Disable Date', 'bizroot' ), 'type' => 'checkbox', 'default' => false, ), 'disable_excerpt' => array( 'label' => __( 'Disable Excerpt', 'bizroot' ), 'type' => 'checkbox', 'default' => false, ), 'disable_more_text' => array( 'label' => __( 'Disable More Text', 'bizroot' ), 'type' => 'checkbox', 'default' => false, ), ); parent::__construct( 'bizroot-latest-news', __( 'Bizroot: Latest News', 'bizroot' ), $opts, array(), $fields ); } /** * Outputs the content for the current widget instance. * * @since 1.0.0 * * @param array $args Display arguments. * @param array $instance Settings for the current widget instance. */ function widget( $args, $instance ) { $params = $this->get_params( $instance ); echo $args['before_widget']; if ( ! empty( $params['title'] ) ) { echo $args['before_title'] . $params['title'] . $args['after_title']; } if ( ! empty( $params['subtitle'] ) ) { echo ''; } $qargs = array( 'posts_per_page' => esc_attr( $params['post_number'] ), 'no_found_rows' => true, ); if ( absint( $params['post_category'] ) > 0 ) { $qargs['category'] = absint( $params['post_category'] ); } $all_posts = get_posts( $qargs ); ?> 'bizroot_widget_call_to_action', 'description' => __( 'Call To Action Widget.', 'bizroot' ), 'customize_selective_refresh' => true, ); $fields = array( 'title' => array( 'label' => __( 'Title:', 'bizroot' ), 'type' => 'text', 'class' => 'widefat', ), 'description' => array( 'label' => __( 'Description:', 'bizroot' ), 'type' => 'textarea', 'class' => 'widefat', ), 'primary_button_text' => array( 'label' => __( 'Button Text:', 'bizroot' ), 'default' => __( 'Learn more', 'bizroot' ), 'type' => 'text', 'class' => 'widefat', ), 'primary_button_url' => array( 'label' => __( 'Button URL:', 'bizroot' ), 'type' => 'url', 'class' => 'widefat', ), ); parent::__construct( 'bizroot-call-to-action', __( 'Bizroot: Call To Action', 'bizroot' ), $opts, array(), $fields ); } /** * Outputs the content for the current widget instance. * * @since 1.0.0 * * @param array $args Display arguments. * @param array $instance Settings for the current widget instance. */ function widget( $args, $instance ) { $params = $this->get_params( $instance ); echo $args['before_widget']; if ( ! empty( $params['title'] ) ) { echo $args['before_title'] . $params['title'] . $args['after_title']; } ?>