robgibbon
Forum Replies Created
Viewing 4 replies - 1 through 4 (of 4 total)
-
Solved this by setting the second domain to http only (no HTTPS) and checking ignore default ports.
Thanks
RForum: Plugins
In reply to: [Ajax Search Lite - Live Search & Filter] search box overwrites mobile menuExcellent – indeed this solved my problem!
thanks!!
RobForum: Plugins
In reply to: [Ajax Search Lite - Live Search & Filter] search box overwrites mobile menuForum: Plugins
In reply to: [Ajax Search Lite - Live Search & Filter] stale resultsI was able to solve this by changing the source of the search query – I was using custom attributes – possibly my custom attributes were broken in some way.
I implemented some results caching in ajax_search.php, it seems to work – here it is:
//Disable caching //header('Cache-Control: no-cache'); //header('Pragma: no-cache'); $action = esc_attr(trim($_POST['action'])); //A bit of security $allowed_actions = WD_ASL_Ajax::getAll(); WD_ASL_Ajax::registerAll(true); if (isset($_POST['aslp']) && isset($_POST['asid']) && !isset($_POST['shift8-ajax'])) { $vc_id = $_POST['aslp'] . $_POST['asid']. $_POST['options']; $post_vars = $_POST; $cache_file = plugin_dir_path(__FILE__)."cache/".hash('md5', $vc_id).".html"; // If the file exists and was cached in the last 5 days... if (file_exists($cache_file) && (filemtime($cache_file) > (time() - (86400*5) ))) { $file = file_get_contents($cache_file); // Get the file from the cache. die($file); // echo the file out to the browser. } else { $post_vars['shift8-ajax'] = true; $result = wp_remote_post( 'https://<YOURSITE>.com/wp-content/plugins/ajax-search-lite/ajax_search.php', array( 'method' => 'POST', 'timeout' => 45, 'redirection' => 5, 'httpversion' => '1.0', 'blocking' => true, 'headers' => array(), 'body' => $post_vars, 'cookies' => array() ) ); if ( is_wp_error( $result ) ) { $error_message = $response->get_error_message(); echo "Something went wrong: $error_message"; } else { $result_body = wp_remote_retrieve_body($result); file_put_contents($cache_file, $result_body, LOCK_EX); die($result_body); } } }
Viewing 4 replies - 1 through 4 (of 4 total)