Skip Navigation

[Resuelto] Wrong results with specific Search (like only a type of posts) ; total 5 results

This support ticket is created hace 4 años, 12 meses. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 12 respuestas, has 2 mensajes.

Last updated by Shane hace 4 años, 11 meses.

Assisted by: Shane.

Autor
Mensajes
#1226106

Anónimo
Screen Shot 2019-04-04 at 3.42.11 PM.png

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

Thank you !
Maud

#1226113

Anónimo
Screen-Shot-2019-04-04-at-3.57.06-PMb.jpg

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

#1226518

Shane
Supporter

Languages: Inglés (English )

Timezone: America/Jamaica (GMT-05:00)

Hello,

Thank you for getting in touch.

I must apologize for the lengthy delay.

Regarding the Slider, the order would need to be specified views using the views order option.

For your search is this a search created in views ?

Please let me know.
Thanks,
Shane

#1227323

Anónimo

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.

Thank you,
Maud

#1227408

Shane
Supporter

Languages: Inglés (English )

Timezone: America/Jamaica (GMT-05:00)

Screenshot 2019-04-08 at 2.40.23 PM.png

Hi Maud,

Have a look at the screenshot .

When you go to edit your view you should see a similar option on your end.

From here you can change the ordering of the view.

Thanks,
Shane

#1227413

Anónimo

I successfully adress the gallery order with the options "Field - Toolset-post-sortorder". It works fine now. 🙂

How about the search results? How to address the results when it seams to be "build in" (in WordPress Archives)?
Thanks,
M

#1227415

Shane
Supporter

Languages: Inglés (English )

Timezone: America/Jamaica (GMT-05:00)

Screenshot 2019-04-08 at 2.52.57 PM.png

Hi Maud,

For the search archives, this wouldn't be possible to control unless you built a custom archive using views for the search results.

In this case custom sorting would be available. See Screenshot

You even have the option to add frontend sorting controls.

Please let me know if this helps.
Thanks,
Shane

#1227420

Anónimo
Screen Shot 2019-04-08 at 3.56.48 PM.png
Screen Shot 2019-04-08 at 3.56.36 PM.png

This is what I did on my Search page.

#1227432

Shane
Supporter

Languages: Inglés (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Maud,

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.

Please let me know if this is clear.

Thanks,
Shane

#1229579

Anónimo

Hi Shane, I'm sorry for the delay.

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

#1229601

Shane
Supporter

Languages: Inglés (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Maud,

Just for clarity on this, you only want the 3 posts types to be displayed, You don't want results from the pages correct?

Do you have the relevanssi plugin installed?

Please let me know.

Thanks,
Shane

#1229604

Anónimo

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

#1229608

Shane
Supporter

Languages: Inglés (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Maud,

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

array('post', 'post-type-slug2', 'post-type-slug1','post-type-slug3')

This will add your respective post types to the search.

Thanks,
Shane

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.