Outputting custom field in search results?

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Outputting custom field in search results?

This topic contains 15 replies, has 2 voices, and was last updated by Ernest Marcinko Ernest Marcinko 3 years, 2 months ago.

Viewing 15 posts - 1 through 15 (of 16 total)
  • Author
    Posts
  • #30382
    chief_martin98
    chief_martin98
    Participant

    Hello!

    I have a question that I hope you can help answer (and solve).

    We are trying to output a logo (.png file) in the search results. So it outputs to the left of the search result heading.

    The logo is a custom field within the user profile.

    Is there a way to do this?

    I hope you can help as it would make the results look super awesome! and would be a great feature.

    Thank you

    #30383
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi,

    You can do it via the advanced title and content fields feature. For user type results, use that feature with the user fields here: https://i.imgur.com/aZiVb8c.png

    Best,
    Ernest Marcinko

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


    #30402
    chief_martin98
    chief_martin98
    Participant
    You cannot access this content.
    #30485
    chief_martin98
    chief_martin98
    Participant

    Hi Ernest,

    I have received back a message from my developer

    “Unfortunately their suggestion won’t work. The logo is stored as an attachment to the user profile. So the image in the user profile is stored in the users database table as just an ID. The location of the image is stored in another database table. So to display the logo, we have to write some code that looks up the ID of the image in the users table and then searches the other table (using that ID as the reference) to find the URL of the image itself.

    Their suggestion would only work for fields stored entirely in the users table.”

    Do you know what sort of code could help pull this attachment in the profile?

    Any help would be greatly appreciated

    Thank you

    (This is the main reason why I have purchased the support again, as we’d really like to get it to work)

    #30488
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi,

    The asp_results hook will help with that. It lets you make direct chagnes to each result field via a loop. I believe your developer will be able to work with that 🙂

    Best,
    Ernest Marcinko

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


    #30852
    chief_martin98
    chief_martin98
    Participant
    You cannot access this content.
    #30867
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Well, that sounds like an easy job to me, but I can’t really give you any code besides the one I linked there. They just need to integrate their solution of getting the image by the user ID – which I assume is not too complicated based on the description – with the hook I linked. In that documentation there is a sample loop where all the most important result fields are explained.

    Best,
    Ernest Marcinko

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


    #30872
    chief_martin98
    chief_martin98
    Participant
    You cannot access this content.
    #30873
    Ernest Marcinko
    Ernest Marcinko
    Keymaster
    You cannot access this content. Best,
    Ernest Marcinko

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


    #30877
    chief_martin98
    chief_martin98
    Participant
    You cannot access this content.
    #31390
    chief_martin98
    chief_martin98
    Participant
    You cannot access this content.
    #31399
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi Martin!

    The size of the images can be adjusted here: https://i.imgur.com/N7kB6wD.png
    On the same panel you can also adjust the size and the count of the rows accordin to your needs: https://i.imgur.com/oryzFUo.png
    If the row max width and the image width is close to each other, they will appear closer as well.

    Also, is it possible to have logos next to the headings, or is that unlikely?
    I may need more details on this? Do you mean like the distance between the group heading and the logo? Adjusting the image width should help with that as well. If you get the width/height to the same ratio as the original image sizes, then the container will have less vertical/horizontal space as well.

    Best,
    Ernest Marcinko

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


    #31420
    chief_martin98
    chief_martin98
    Participant
    You cannot access this content.
    #31437
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    The number of rows is unfortunately same for each group – beacause the groups are not actually within a separated container, but the group headers are on the same level as the results, but it is set to span through all the rows. I am not sure if it is even possible without customization.
    The other one definitely needs customization too. I can recommend the results templating feature (if I haven’t already).

    Best,
    Ernest Marcinko

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


    #31492
    chief_martin98
    chief_martin98
    Participant
    You cannot access this content.
Viewing 15 posts - 1 through 15 (of 16 total)

You must be logged in to reply to this topic.