Wrong results with specific Search (like only a type of posts) ;
total 5 results; we want to have the total results adapts to the specific search we want, showing the 3 results at the top and the three posts only.
Also, where can I change the text? I would like to have
5 result(s) only
I also have an issue with an image gallery you helped me with a while ago. After we entered the pictures, it seams we can not change the order. Well, we change it in the page but it won't take effect in the website. It is a multiple photo-gallery, with a picture and legend attached. I'm sending a picture to help understanding. The pictures order (left) is not the same as the one showed in the website (right).
It is quite late around here so I might come back tomorrow if you have «solutions or questions» for me. Thanks again Shane, and have a nice evening !
M
Hello Shane, Thank you for the response. It was a weekend, so you can take off too!
Regarding this response :"Regarding the Slider, the order would need to be specified views using the views order option." Could you tell me how to do this please? I'm not sure where to find this views order option.
The search is an Archives with, yes I think, created in views.
From the screenshot i'm able to see the ordering option for the archive.
If you want the frontend sorting to be available you will need to click on Display option at the top of the view in the right hand corner and enable the Search settings for the view.
Then you can scroll to the filter option editor then setup the ordering settings.
Well, this is not exactly what I need ...or I don't understand what you are trying to tell me. On my Search page (WordPress Archives for search), when I make a search , I just want my customs types to be displayed in the results, no page, nothing else. So right now, at the top of the page, I can see 5 results for a search ; 2 pages and 3 custom types. I am trying to change the result from 5 (all) to 3 (only what I want to display).
At the bottom, I can see the only 3 results I am looking for. So that parts works.
Thank you,
M
Hi Shane, Thank you for your response.
That is correct. I only want the custom types to be displayed as it is possible to select at the top of the page. And I don't have relevanssi plugin installed.
🙂
M
We should be able to do it with the relevanssi plugin but this hook below will work just as well.
function cus_post_search_filter($query) {
if (!$query->is_admin && $query->is_search) {
$query->set('post_type', array('post', 'page', 'book'));
}
return $query;
}
add_filter('pre_get_posts', 'cus_post_search_filter');
Where you see I have the array('post', 'page', 'book') what you need to do is to remove page from the array so it looks like this. array('post', 'book')
To add you post types to the search just add the slugs to it.
Example