How to make custom WordPress page deliver search results

Maybe it´s easier to output some content from a different page/post in your search template which got a fixed slug.

I for example use this:

$page = get_posts(array('name' => 'welcome'));
if ($page)
{
   echo '<h1>'.$page[0]->post_title.'</h1>';
   echo '<p>'.$page[0]->post_content.'</p>';
}

This fetches the post with the slug “welcome” and displays its content. As I don´t use a single post display this works fine for my special case.

Maybe it can help you, too.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)