Change Search Bar

Posted in: Newspaper
Post count: 15

Hello! So by default, I know the header search bar searches the local wordpress. Now what if I want the header search bar to search a different website? For example, the website is http://a.com and there is a header search on it, but I want for when users type something into the search bar, it sends the request to http://b.com/searchstring?={whatever the user typed into the search bar} instead? Before the 9.7 update, I just used a child theme to replace the header: /parts/header/header-menu.php, but now with the new rules…apparently that doesn’t work anymore. I even tried making the changes in the Newspaper core files, but it wouldn’t take either. So I’m looking for a solution that wouldn’t break if there are Newspaper theme updates. Thanks!

Post count: 20688

Hi,

That would be the case, the child theme is quite limited after the recent update. Most theme files have been moved in the composer plugin as mentioned here
– https://tagdiv.com/updating-the-core-of-tagdiv-themes/
So now the file that you used to modify is in the composer – http://prntscr.com/nfpxm0 which could be modified but you will have to do it each time you update the theme and plugins.

Maybe consider using a search plugin which has this functionality, try free plugins. Here are some examples – https://colorlib.com/wp/search-plugins-for-wordpress/
– https://www.quora.com/Is-there-a-WordPress-search-engine-plugin-that-allows-you-to-search-outside-of-your-website

Thanks

Post count: 15

Sorry for the delay in reply! So I tried this…checked the source code and it’s showing my changes, but when I hit the search button or hit enter, it’s still searching WordPress. It’s very strange, it’s the same code i used before except I’m changing the core theme plugin files vs the child theme. I changed header-menu.php, header-menu-h1.php, header-menu-h2.php, and header-menu-2.php and nothing changes.

Post count: 20688

If it’s the same code and you modify the files same as before, it should work the same. Maybe double check the modifications, make sure they are made correctly. I haven’t tried this myself however.

But maybe it would also be better to consider using a plugin for this, this way you won’t have to make the same modifications to the files again and again, after each theme and theme plugins update.

Viewing 4 posts - 1 through 4 (of 4 total)
The forum ‘Newspaper’ is closed to new topics and replies.