Is there a way to cahe searches in wp?

nope, when somebody search something in my blog, the result page to be cached as a html and not dynamic as php.
 
hmmm i think that it can be done...
in search.php file (in your template folder) you can add variable for saving whole page with search resoults (eg.$s_content)

PHP:
$s_content='<div id="content">';

<?php if (have_posts()) : ?>
	$s_content.='next tags for template blablabla';
	<?php while (have_posts()) : the_post(); ?>

//here another tags for conent (for titles dates etc)

$s_content.=get_the_content();

//here another tags for conent
	<?php endwhile; ?>
<?php endif; ?>

you need to use wp functions with "get_" at the begining in the name or with "echo=0" as arguments to not show resoults but save it in variable.
than just save this variable in *.html file using
fopen():
fwrite();
fclose();


and show it using redirection/including/iframe etc etc
After that you can delete this file or save it for search engines



I hope you will understand the idea how it can be done.

regards
Cyklotrial
 
nope, sorry, i didn't :( i mean like in wp cache, like the other pages...
there are some cache plugins but they cache just posts...
 
Last edited:
Back
Top