/**
 * Add live search JavaScript to the footer
 */
function st_add_live_search()
{
    if (of_get_option('st_live_search') == '0') {
        if (class_exists('bbPress')) {
            if (get_post_type() == 'forum' || get_post_type() == 'topic' || get_post_type() == 'reply' || bbp_is_search()) {
                // If BBPRess
                ?>
		<script type="text/javascript">
		jQuery(document).ready(function() {
		jQuery('#live-search #s').liveSearch({url: '<?php 
                bbp_search_url();
                ?>
/?ajax=on&bbp_search='});
		});
		</script>
   <?php 
            }
        } else {
            // If KB
            ?>
   		<script type="text/javascript">
		jQuery(document).ready(function() {
		jQuery('#live-search #s').liveSearch({url: '<?php 
            echo home_url();
            ?>
/?ajax=on&post_type=st_kb&s='});
		});
		</script>
	<?php 
        }
    }
}
<?php

/**
 * Search
 *
 * @package bbPress
 * @subpackage Theme
 */
?>

<form role="search" method="get" class="searchform bbp-search-form search-form" action="<?php 
bbp_search_url();
?>
">
	<div class="search-table">
		<label class="screen-reader-text hidden" for="bbp_search"><?php 
_e('Search for:', 'bbpress');
?>
</label>
		<input type="hidden" name="action" value="bbp-search-request" />
		<div class="search-field">
			<input tabindex="<?php 
bbp_tab_index();
?>
" type="text" value="<?php 
echo esc_attr(bbp_get_search_terms());
?>
" placeholder="<?php 
_e('Search the Forum...', 'Avada');
?>
" name="bbp_search" id="bbp_search" />
    /**
     * Render a special "new search" form on top of the search results page.
     */
    public function add_search_page_search_form()
    {
        ?>
		<div class="search-page-search-form search-page-search-form-top">
			<h2><?php 
        echo __('Need a new search?', 'Avada');
        ?>
</h2>
			<p><?php 
        echo __('If you didn\'t find what you were looking for, try a new search!', 'Avada');
        ?>
</p>
			<form role="search" method="get" class="bbp-search-form seach-form searchform" action="<?php 
        bbp_search_url();
        ?>
">
				<div class="search-table">
					<label class="screen-reader-text hidden" for="bbp_search"><?php 
        _e('Search for:', 'bbpress');
        ?>
</label>
					<input type="hidden" name="action" value="bbp-search-request" />
					<div class="search-field">
						<input tabindex="<?php 
        bbp_tab_index();
        ?>
" type="text" value="<?php 
        echo esc_attr(bbp_get_search_terms());
        ?>
" placeholder="<?php 
        _e('Search the Forum...', 'Avada');
        ?>
" name="bbp_search" id="bbp_search" />
					</div>
					<div class="search-button">
						<input tabindex="<?php 
        bbp_tab_index();
        ?>
" class="fusion-button button submit" type="submit" id="bbp_search_submit" value="&#xf002;" />
					</div>
				</div>
			</form>
		</div>
		<?php 
    }