Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Show category in result title
- This topic has 18 replies, 2 voices, and was last updated 8 years, 9 months ago by
Numaphon.
-
AuthorPosts
-
August 9, 2017 at 10:19 am #14179
Numaphon
ParticipantHi!
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 #14199Ernest Marcinko
KeymasterHi!
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:
[php]$pageposts[$k]->title .= " ".$cats;[/php]
..to this:
[php]$pageposts[$k]->title = $cats .’ ‘. $pageposts[$k]->title;[/php]
I hope this helps!
August 10, 2017 at 8:07 pm #14214Numaphon
ParticipantHi 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,
NumaphonAugust 11, 2017 at 9:33 pm #14249Ernest Marcinko
KeymasterHi!
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.
August 15, 2017 at 4:08 pm #14277Numaphon
ParticipantHi 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.August 16, 2017 at 10:16 am #14284Ernest Marcinko
KeymasterHi!
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.
August 16, 2017 at 4:34 pm #14300Numaphon
ParticipantHi 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 #14301Numaphon
ParticipantI’m not Akinyemi Lawrence, who is Akinyemi ?
August 17, 2017 at 8:49 am #14314Ernest Marcinko
KeymasterHi!
I just tried on a desktop, but it’s working for me for some reason: https://youtu.be/eGJryms9RqU
Make sure to clear your cache, in case you updated recently. Is this happening on a specific browser?August 18, 2017 at 8:54 pm #14382Numaphon
ParticipantHi 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
August 21, 2017 at 11:08 am #14395Ernest Marcinko
KeymasterHi!
1. Coloring select items might not be supported within all browsers, but you could try the following:
To color parent items:
[html]select .asp_option_cat_level-1 {
color: red !important;
}[/html]To color child (sub) items:
[html]select .asp_option_cat_level-1 {
color: blue !important;
}[/html]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
I don’t think there is a workaround 🙁August 22, 2017 at 1:48 pm #14442Numaphon
Participantthanks 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 #14445Ernest Marcinko
KeymasterHi!
One possible place is the custom CSS box under the Theme Options -> Custom CSS panel: http://i.imgur.com/p7DqLSJ.png
Don’t worry about it, WordPress is not as easy as it seems, I understand that.
August 22, 2017 at 6:13 pm #14450Numaphon
ParticipantDear 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 #14456Ernest Marcinko
KeymasterHi 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?
-
AuthorPosts
- You must be logged in to reply to this topic.