Tagged: search
-
AuthorPosts
-
September 21, 2016 at 1:03 pm #689756
Hi All,
when I type something in the search bar and no results are returned, I come to a page which states that nor results are found, then you are advised to check for spelling etc. and then some posts are displayed.
I want to get rid of these posts.On the forum, It was said that you can remove them in the error404.php file, but this does nothing for me. After trying a lot, I found that the text that advises you to check the spelling etc. is in the loop-search.php file. However, I am unable to find how I can delete the posts being shown on this search page.
In addition, when I type something in the search bar and I do wait for results t come up, it might say that “Sorry, no posts matched your criteria”.Where do I change this text?
Any help is appreciated. Thanks!
Geert
September 21, 2016 at 3:04 pm #689851Hey Geert,
Thanks for reaching out to us!
Both changes can be done in the 404.php file. You can remove the related posts and edit the text there. If you need further assistance please provide login credentials to your site along with FTP credentials if possible. You can place the info in the private data section.
Best regards,
JordanSeptember 21, 2016 at 4:11 pm #689893Hi Jordan,
this is the content of my 404.php file
// EDITED.. please use pastebin.com for long codes
Also in here, there is no text that says “Sorry, no posts matched your criteria” and when I delete the <section class=”404_recommendation”> section, nothing changes.
BTW: I only change the PHP in WordPress (Appearance>Editor). Can this be the limiting factor?
Cheers.,
Geert
September 24, 2016 at 7:07 am #691092Hi!
In the includes > error404.php file, please remove this block of code:
<h3 class=''><?php _e('Feel like browsing some posts instead?', 'avia_framework'); ?></h3> <?php the_widget('avia_combo_widget', 'error404widget', array('widget_id'=>'404', 'before_widget' => '<div class="widget avia_combo_widget">', 'after_widget' => '</div>', 'before_title' => '<h3 class="widgettitle">', 'after_title' => '</h3>' ));
To change the text, add this code in the functions.php file:
add_filter('avf_ajax_search_messages', 'my_search_text', 10,2); function my_search_text ($search_messages, $search_query) { // possible values to change: // // $search_messages = array( // 'no_criteria_matched' => __("Sorry, no posts matched your criteria", 'avia_framework'), // 'another_search_term' => __("Please try another search term", 'avia_framework'), // 'time_format' => get_option('date_format'), // 'all_results_query' => http_build_query($_REQUEST), // 'all_results_link' => home_url('?' . http_build_query($_REQUEST)), // 'view_all_results' => __('View all results','avia_framework') // ); $search_messages ['no_criteria_matched'] = 'your message text to replace'; return $search_messages; }
Related thread: https://kriesi.at/support/topic/custom-search-messages/#post-371601
Regards,
Ismael -
AuthorPosts
- You must be logged in to reply to this topic.