Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Show category in result title
This topic contains 18 replies, has 2 voices, and was last updated by Numaphon 7 years ago.
- AuthorPosts
- August 9, 2017 at 10:19 am #14179
Hi!
Is this possible to include the category of the post in the vertical results?
For example, searching “Dragonstone” will correctly return the post “7×01 Dragonstone” as a result, but I need to show the category before the title, something like “Game of Thrones 7×01 Dragonstone”. It will be ok also to add the category under the title, along with author and date metadata.
How can I do that?
Thanks!August 9, 2017 at 5:21 pm #14199Hi!
Yes, with a custom filter code it is actually possible. I believe you are looking for this tutorial: https://wp-dreams.com/knowledge-base/showing-the-category-titles-in-the-result-title/
To move the category titles before the actual title, just change this line from the tutorial code:
$pageposts[$k]->title .= " ".$cats;
..to this:
$pageposts[$k]->title = $cats .' '. $pageposts[$k]->title;
I hope this helps!
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
August 10, 2017 at 8:07 pm #14214Hi Ernest,
1) How can I assign “category name” for each item above the title
or place the category name in the feature image.1.1) Article with multiple-categories, when select 1 of many categories, ‘no result’ displayed. I have to select all the categories assigned for that single Article, then the result displayed.
2) I would like to have sub-category, what is the custom field for category and sub-category
Thanks & best regards,
NumaphonAttachments:
You must be logged in to view attached files.August 11, 2017 at 9:33 pm #14249Hi!
1. That I believe is only possible with directly changing the result template, you can find more information about results templating here.
Basically, I would first place a custom code there to get the categories. Then, if there are categories, then add a HTML code just above the title, or wherever it is needed. Let me know if you need further help with this. Since this is a customization request, I cannot guarantee my suggestions will work in all cases though.
1.1. On the Frontend search settings -> Advanced options panel change the first option, I believe that is what you are looking for: https://i.imgur.com/LnpgX6J.png
2. Do you mean sub-items for custom field filters? I don’t think this is possible, I’m not sure.
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
August 15, 2017 at 4:08 pm #14277Hi Ernest,
I always have difficulties in finding your reply.
for # 1.1
I’ve already followed your instruction, but I don’t know what’s going wrong with me, the checkbox can’t be clicked.Attachments:
You must be logged in to view attached files.August 16, 2017 at 10:16 am #14284Hi!
1.1 Can you link me to a page where I can see this? It’s hard to tell what could be wrong there, without seeing it.
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
August 16, 2017 at 4:34 pm #14300Hi Ernest,
sorry, I forgot to link the page
https://www.thailaw.info/the check mark can be clicked on iPhone but can’t on notebook
Thanks & best regards,
NumaphonAugust 16, 2017 at 4:35 pm #14301I’m not Akinyemi Lawrence, who is Akinyemi ?
August 17, 2017 at 8:49 am #14314Hi!
I just tried on a desktop, but it’s working for me for some reason: https://youtu.be/eGJryms9RqU
Best,
Make sure to clear your cache, in case you updated recently. Is this happening on a specific browser?
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
August 18, 2017 at 8:54 pm #14382Hi Ernest,
2 more questions for today, Ernest -_-
1) how can I assign different color for ‘category’ and ‘sub-category’
2) the setting box for ‘drop down’ is too high, how can I reduce it
big thanks for your kind support
best regards,
NumaphonFYI: my url = https://thailaw.info
Attachments:
You must be logged in to view attached files.August 21, 2017 at 11:08 am #14395Hi!
1. Coloring select items might not be supported within all browsers, but you could try the following:
To color parent items:
select .asp_option_cat_level-1 { color: red !important; }
To color child (sub) items:
select .asp_option_cat_level-1 { color: blue !important; }
2. Unfortunately as far as I know this is impossible, as it is browser specific, please see: https://stackoverflow.com/questions/570642/height-of-an-html-select-box-dropdown/570651#570651
Best,
I don’t think there is a workaround 🙁
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
August 22, 2017 at 1:48 pm #14442thanks so much, Ernest
where should I put the above codes, please ?
sorry for disturbing you, I’m a lawyer but would like to design my own web.best regards,
NumaphonAugust 22, 2017 at 3:57 pm #14445Hi!
One possible place is the custom CSS box under the Theme Options -> Custom CSS panel: https://i.imgur.com/p7DqLSJ.png
Don’t worry about it, WordPress is not as easy as it seems, I understand that.
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
August 22, 2017 at 6:13 pm #14450Dear Ernest,
nothing change, I’m not sure that it may be caused from “taxonomy chain menu” which fixed the dropdown menu color ?
do you have any idea to make it easier to differentiate the category and sub-cat ?
thanks & best regards,
NumaphonAugust 23, 2017 at 12:42 pm #14456Hi Numaphon,
I don’t see the custom code CSS anywhere, that’s why it’s not visible. Are you sure you have placed it correctly?
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
- AuthorPosts
You must be logged in to reply to this topic.