Show category in result title

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 Jeffrey Zhang Numaphon 4 years, 10 months ago.

Viewing 15 posts - 1 through 15 (of 19 total)
  • Author
    Posts
  • #14179
    Jeffrey Zhang
    Numaphon
    Participant

    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!

    #14199
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi!

    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 :)


    #14214
    Jeffrey Zhang
    Numaphon
    Participant

    Hi 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,
    Numaphon

    Attachments:
    You must be logged in to view attached files.
    #14249
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi!

    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 :)


    #14277
    Jeffrey Zhang
    Numaphon
    Participant

    Hi 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.
    #14284
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi!

    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 :)


    #14300
    Jeffrey Zhang
    Numaphon
    Participant

    Hi 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,
    Numaphon

    #14301
    Jeffrey Zhang
    Numaphon
    Participant

    I’m not Akinyemi Lawrence, who is Akinyemi ?

    #14314
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi!

    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?

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #14382
    Jeffrey Zhang
    Numaphon
    Participant

    Hi 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,
    Numaphon

    FYI: my url = https://thailaw.info

    Attachments:
    You must be logged in to view attached files.
    #14395
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi!

    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
    I don’t think there is a workaround 🙁

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #14442
    Jeffrey Zhang
    Numaphon
    Participant

    thanks 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,
    Numaphon

    #14445
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi!

    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 :)


    #14450
    Jeffrey Zhang
    Numaphon
    Participant

    Dear 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,
    Numaphon

    #14456
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi 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 :)


Viewing 15 posts - 1 through 15 (of 19 total)

You must be logged in to reply to this topic.