Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Omit URL from Search
This topic contains 6 replies, has 2 voices, and was last updated by spdev87 4 years, 11 months ago.
- AuthorPosts
- September 18, 2019 at 8:31 pm #24043
I haven’t been able to find out how to omit certain posts from AJAX Search Pro. For example, I don’t want any thank you or confirmation pages to be searchable.
How do I add a list of URLs that will be omitted from all searches?Thanks in advance…
Pete GroszSeptember 19, 2019 at 9:34 am #24050Hi Pete,
You can exclude items from the search under the
Advanced Options -> Exclude/Include results
panel.In your case you are looking for the Exclude posts/pages/cpt option. There you can search for posts/pages etc.. and exclude them manually.
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
September 19, 2019 at 3:40 pm #24081Hi Ernest,
Thank you for your quick reply. Much appreciated! Works perfectly.
I have another quick question…
When I search from the input box, a drop-down appears with results and the first image of each page becomes the thumbnail next to each search result. This is exactly what we want.However, on a few pages, the first image is a small 16×16 icon that appears above the first image and as a result the image that we would want to be the thumbnail next to the search result is now the second image on the page. How do we make it so an image below a certain size is ignored in the search results? What also would work in our case is to simply ignore the icon (e.g. icon16x16.png) from being used as the thumbnail in any search results. How can this be accomplished?
I checked image options and can’t see an option for the above situation.
Thanks in advance…
Pete GroszSeptember 20, 2019 at 8:56 am #24086Hi Pete,
Well this would only work with a direct modification to the core code. I am not sure if the image size can be used within the code though, it may require a specific image parser script as well as a server module – but I am not sure about that.
Best,
I can recommend a change to use the second image instead of the first one, but that will affect all of the results though.
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
September 20, 2019 at 4:19 pm #24094Hi Ernest,
Since the issue is with one icon that is used across many posts, can we make it so the name of this icon (icon16x16.png) not be used in any thumbnails in the search results?
Similar to how we exclude posts from search results, we could exclude image names too.—
Regards,
Pete GroszSeptember 23, 2019 at 9:19 am #24101Hi,
The file name exclusion is actually a good feature idea. I might add it to the upcoming release.
I have made a custom code, which might actually do the exclusion in a post process. Try adding this custom code to the functions.php in your theme/child theme directory. Before editing, please make sure to have a full site back-up just in case!
add_filter('asp_results', 'asp_results_change_image_by_name', 10, 1); function asp_results_change_image_by_name($results) { $exclude = 'icon16x16.png'; foreach ( $results as $k => &$r ) { if ( $r->content_type != 'pagepost' ) continue; if ( !empty($r->image) && strpos($r->image, $exclude) !== false ) { $r->image = wpdreams_get_image_from_content(get_post_field('post_content', $r->id), 1); } } return $results; }
Please be careful, as I have not been able to test this code.
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
September 23, 2019 at 9:29 pm #24104Hi Ernest,
I’ll test it tomorrow or the day after I have a few automatic backups to fall back on and then I’ll let you know.—
Regards,
Pete Grosz - AuthorPosts
You must be logged in to reply to this topic.