Skip Navigation

[Resolved] i need the results of a search view to show first the title results

This support ticket is created 7 years, 2 months ago. 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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 5 replies, has 2 voices.

Last updated by Minesh 7 years, 1 month ago.

Assisted by: Minesh.

Author
Posts
#573538

shalom bsd
i made a view that works with a shortcode and search the posts by a custom type post.
i put it to search by title and content.
I 'd like that vies show me first of all the tiltle match results with the world and than the posts content match results.
is that possible?

#573642

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Well - view's output will work just like normal loop so this is not possible to group all title first and then post content. However - what if you try to create two view's one will display the title and one will display the post content.

#573796

bsd

yes but i have no option to chose only title.
i have only "title" or "title and content"

#574004

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Well - it seems if I can see your exact requirement with screenshot I can give you concrete answer as without knowing your exact requirement I can not guide you in right direction. Could you please share how exactly you want to display the results with text case example or few screenshot?

If your requirement is same as I told you to group only title first and display it first and then group all post content and display it then its not possible without having two views belongs to same content type.

#574093
dockins.png
search.png

Ok , i will try more explicitly:
i have a custom type called "persons" - this are names of scientists that are mentioned all over the posts.
i also added a custom field for the word to serach called "search-word-for persons"
i created a view "view grid for person" that will show all posts that a specific person is mentioned in its title or content.
for this - i defined in the query filter to search by a shortcode called "person", and in the options "where to search " i choosed "Posts content and title"
Than i made a ;person custom type post " content template that calls the view :
[wpv-view name="view grid for person" person="[types field='search-word-for-persons'][/types]"]

Now - it works fine - but it shows all results in posts that the person appears both in title or description.
The problem is that it doesn't show as the first results the posts that this persons appears in title, but just go according to the posts date.

it should be a solution to show two views like you mentioned - one with only title results (wich is possible) and the other ONLY the content match results - but there is not such option in query search otions....

in the picture example - the view show for a search word "dockins" - in hebrew "דוקינס"
as you see the first result (right side) is a content match result
the second is a title result match and so one - according to the post date.

is that clear now?

#574105

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Yes - there is no such native option available to search only in post content and not in title and also as you said its logical even if we create one view to display the title and for another view there is no option to search in only content.

However - I have one more way but I'm not sure if that help you. What if you try to use view's API hook: wpv_filter_query and try to modify your view's query on fly and add/remove post content search as needed.

More info:
=> https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_query

I would like to give a try but please note that there is no native feature available so there is no guarantee that there is definite solution available. I need temporary access details with problem URL.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I would additionally need your permission to de- and re-activate Plugins and the Theme, and to change configurations on the site. This is also a reason the backup is really important. If you agree to this, please use the form fields I have enabled below to provide temporary access details (wp-admin and FTP).

I have set the next reply to private which means only you and I have access to it.