adding ajax search shortcode to the forum template
authorAnthony Talarico <talarico@gaslightmedia.com>
Thu, 12 Jan 2017 21:55:13 +0000 (16:55 -0500)
committerAnthony Talarico <talarico@gaslightmedia.com>
Thu, 12 Jan 2017 21:55:13 +0000 (16:55 -0500)
functions.php
sections/interior-page.php

index 2159eef..8e317d5 100644 (file)
@@ -142,44 +142,6 @@ function is_post_type($type){
 add_action('thematic_searchloop', 'mytheme_search_loop');
 // End of the Contextual/Highlight Search functions
 
-function import_forum() {
-    $url = get_site_url() . '/import-forum';
-    global $wpdb;
-    $table = $wpdb->posts;
-    $limit = 100;
-    $return_string = '';
-    
-    if ( isset( $_REQUEST['start'] ) ) {
-        $start = filter_var( $_REQUEST['start'], FILTER_VALIDATE_INT );
-    } else {
-        $start = 0;
-    }
-
-    $sql = "
-    SELECT *
-    FROM $table
-    WHERE post_type = 'topic'";
-    $sql .= " LIMIT $limit OFFSET $start";
-    $results = $wpdb->get_results( $sql, ARRAY_A );
-
-    $event_counter = 0;
-
-    if ( !empty( $results ) ) {
-        foreach ( $results as $post ) {
-            $slug = sanitize_title($post['post_title']);
-            $wpdb->update($wpdb->posts,array('post_name'=>$slug), array('ID'=>$post['ID']));
-        }
-    }
-    $return_string .= "<pre>
-        Start: $start
-    </pre>";
-    $start += $limit;
-    $return_string .= "<p><a href=\""
-        . $url
-        . "?start=$start\">Next</a></p>";
-    return $return_string;
-}
-
 function searchfilter($query) {
     if(isset($_GET['searchType'])){
         if ($query->is_search && !is_admin() ) {
index 334643c..8d9ff71 100644 (file)
                 <div>
                    <?php get_template_part('parts/breadcrumbs'); ?>
                         <div id="interior-content" class="no-sidebar-content small-12 columns">
-                           <form role="search" method="get" class="searchform forum-search" action="<?php echo home_url('/'); ?>">
-                                 <input class="search-input" type="text" placeholder="Search" value="" name="s">
-                                 <input class="submit blogbutton" type="submit" name="submit" value="Search" />
-                                 <input type="hidden" name="searchType" value="topic" /> 
-                            </form>
+                            <?php echo do_shortcode('[wpdreams_ajaxsearchlite]'); ?>
                             <?php get_template_part('parts/main-content');?>
                         </div>
                 </div>