/** * Outputs the content of the widget. * * @param array args The array of form elements * @param array instance The current instance of the widget */ public function widget($args, $instance) { extract($args, EXTR_SKIP); $instance = wp_parse_args($instance, $this->defaults); echo $before_widget; $title = isset($instance['title']) ? $instance['title'] : ""; $title = apply_filters('widget_title', $title); if ($title) { echo $before_title . $title . $after_title; } ?> <form class="hkb_widget_search__form" method="get" action="<?php echo home_url('/'); ?> "> <label class="hkb-screen-reader-text" for="s"><?php _e('Search For', 'ht-knowledge-base'); ?> </label> <input class="hkb_widget_search__field" type="text" value="<?php echo get_search_query(); ?> " placeholder="<?php echo hkb_get_knowledgebase_searchbox_placeholder_text(); ?> " name="s" autocomplete="off"> <input type="hidden" name="ht-kb-search" value="1" /> </form> <?php echo $after_widget; }
<?php if (hkb_show_knowledgebase_search()) { ?> <?php /* important - load live search scripts */ ht_knowledge_base_activate_live_search(); ?> <form class="hkb-site-search" method="get" action="<?php echo home_url('/'); ?> "> <label class="hkb-screen-reader-text" for="s"><?php _e('Search For', 'ht-knowledge-base'); ?> </label> <input class="hkb-site-search__field" type="text" value="<?php echo get_search_query(); ?> " placeholder="<?php echo hkb_get_knowledgebase_searchbox_placeholder_text(); ?> " name="s" autocomplete="off"> <input type="hidden" name="ht-kb-search" value="1" /> <button class="hkb-site-search__button" type="submit"><span><?php _e('Search', 'ht-knowledge-base'); ?> </span></button> </form> <?php }