ImCesar
Member
When i search a qurey that doesn't exist on my site it will show a white page without any kind of statement like ''The post you are looking for not exist in this site". How can i add this ?
When i search a qurey that doesn't exist on my site it will show a white page without any kind of statement like ''The post you are looking for not exist in this site". How can i add this ?
When i search a qurey that doesn't exist on my site it will show a white page without any kind of statement like ''The post you are looking for not exist in this site". How can i add this ?
You can achieve this in two ways.
1. Edit the "search.php" in your WP installation. I prefer this because it offers more customization option, but be careful when editing WP files. It requires some background in HTML and a little PHP. it's easy peasy once you get the hang of it.
2. Get a plugin that will do this for you (safe), but your options are limited to what the plugin can offer. Plus extra load to your website, and some of these plugins still use old jQuery versions(render blocking) = sloooow
Other way, you can borrowJust use google
![]()
7 Best Free 404 Redirect Plugins for WordPress (2024)
Are you experiencing a lot of 404 page not found errors in WordPress? Take a look at these 7 best free 404 redirect plugins for WordPress.www.wpbeginner.com
use elementor template.When i search a qurey that doesn't exist on my site it will show a white page without any kind of statement like ''The post you are looking for not exist in this site". How can i add this ?
Using plugin can slow down site i want use alternate method
<script> (function() { var cx = 'partner-pub-xxxxxxxxxxxxxxxx:xxxxxx-xxxx'; var gcse = document.createElement('script'); gcse.type = 'text/javascript'; gcse.async = true; gcse.src = 'https://cse.google.com/cse.js?cx=' + cx; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(gcse, s); })(); </script> <gcse:searchresults-only></gcse:searchresults-only> |
<div class="searchbox"> <form action="https://techbrij.com/search-result" id="cse-search-box" method="get"> <div> <?php if (isset($_GET['q'])) { ?> <input type="text" name="q" size="35" id="txtGoogleSearch" placeholder="Search Here" value='<?php echo $_GET['q'] ?>' /> <?php } else {?> <input type="text" name="q" size="35" id="txtGoogleSearch" placeholder="Search Here" /> <?php } ?> </div> </form> </div> |
I know Html I can edit it but i can't understand the contains of search.php file. What should i do ?