Fixing search in wordpress

Fixing search in wordpress

Hey folks – I noticed it wasn’t working here anymore. Sorry ’bout that!

Here’s what I had to do to get it back on-line:

Firstly, I reverted back to the default WP search using the Search widget in the sidebar. I was previously using a plug-in and wasn’t sure if it was playing a part in my problems. (I had recently switched hosting providers and made changes to my site and home URLS)

After adding the widget, it threw the search box in a strange place on the sidebar. Had to get that sorted. Used the following CSS in my style.css file:

Now it’s right up at the top. Good

Under the hood – search.php and searchform.php

1. I switched themes to twenty seventeen and noticed it worked ok so narrowed it down to something in my theme files (I’m using Thoughts)

2. Turned on debugging in wp-config.php by setting define('WP_DEBUG','true');

3. Noticed I was getting a parse error in search.php. Appears there was an ampersand before the keyword new. Removed it and saved file. Here’s what the line looks like now:

4. Switched back to main theme. Tested and all working Ok!

Search away!

Monday is off to a good start!

Leave a Reply

Be the First to Comment!

Notify of