Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Query regarding search results links to external sites and other issues
This topic contains 11 replies, has 2 voices, and was last updated by Ernest Marcinko 1 year, 5 months ago.
- AuthorPosts
- October 4, 2021 at 10:47 pm #35003
Hi there,
I have recently bought the Pro upgrade version. Great product!
But having been through the documentation – I am struggling to resolve the following issues: Please see following screenshot:
https://prnt.sc/1usu7dcISSUE 1:
When clicking on drop-down search results images, the magnifier link needs to go to different external websites in a new window. i.e. I would need to set up an address: https://xxxxxxx.xxx for each resultant image to redirect to. This works correctly using the Kadence theme with the Advanced Image Gallery, where I can set up the image external links, but I can’t find a way to redirect the images by using the Search Function image results that appear with the rollover/hover magnifier icon link?What is the best way to set up all these EXTERNAL website links from the magnifier icon on each image?
ISSUE 2:
Ideally, instead of a dropdown set of results, I would like to to set up the following:
AFTER a search I want to see the page EXACTLY as it was BEFORE the search but with the NON-SEARCH RESULT ITEMS removed….
i.e. images must still be clickable to external websites, etc..EXACTLY as the functions using the Kadence Theme Advanced Image Gallery are set up on the main page…Is this type of search display possible to achieve using AjaxsearchPro – and if so – how would I need to set it up to do this?
Thank you,
Kind regards,
SallyOctober 5, 2021 at 1:58 pm #35016Hi,
Thank you for your kind words!
1. If you mean opening all the result in a new tab, you can use this option. There is also a possibility to open only the results pointing to an external URL in a new tab via using this custom code.
2. Well, the items printed there by default are not part of the search plugin, so this will have to be custom coded somehow. You can use the search javascript API for hooks to detect when a search is finished and perhaps remove the other items.
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
October 6, 2021 at 1:03 am #35022Hi again,
Thank you for your response to my queries and for your help. Much appreciated!
Regarding the first issue, I thought it best to illustrate with some images to explain my problem.
https://prnt.sc/1uy4cbf
https://prnt.sc/1uy4swn
I can either link the image results to – attachment page, or attachment file directly, or attachment parent post from your “Link the results to: options”…What I want to do is direct each search result to an external URL – as I have set it up in the Kadence Theme:
https://prnt.sc/1uy5w72
i.e. Gallery Link URL: anywebsite.com i.e. each image to a different website ?
Gallery Link Target: new windowIs there a way to set this up, so the resulting images, when clicked on – go directly to the Gallery Link URL – instead of the three options you provide?
I hope this helps to make it clearer as to what i want to accomplish – and hope you can help in some way?
Thanks,
Kind regards,
SallyOctober 6, 2021 at 11:23 am #35032I think it should be doable via a custom code. That URL field looks like it is a custom field of some sort. All I need to know for this is what is the field name to get the URL, or if it is not a custom field, then how to get that URL programmatically.
Best,
Because this is not a built-in feature of WordPress there is probably an API for the plugin adding this feature. There is probably a function of some sort which can return the external URL based on the media attachment ID. If you can find that function (maybe by asking the plugin developer?), then I can add it to a custom code, which should take care of it.
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
October 6, 2021 at 1:55 pm #35039Hi Ernest,
Thanks for getting back to me and for your willingness to help me with this. I have just emailed Chris from Kadence, who initially recommended your search plugin – and hope to hear back from him soon. I will get back to you as soon as possible…
SallyOctober 6, 2021 at 3:08 pm #35042I am sure he will if he recommended our plugin. It is probably a very simple fix, I am about 90% sure it is a simple custom field value, but let’s wait for his response.
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
October 7, 2021 at 11:53 pm #35069Hi,
I have had some comeback from the developer, who has kindly provided me with the following:“A way to access the link URL you can use this PHP function : get_post_meta( $attachment_id, ‘_gallery_link_url’, true );
So integrating that with your search results will require custom code from them but as far as access that link the above code would do it.”
I have taken a screenshot of the theme Gallery Link Settings: https://prnt.sc/1v7vtaj
Link to:
Attachment
Media File
Custom – which I have selected for external links
NoneI hope this helps!
Thanks,
SallyOctober 8, 2021 at 6:28 am #35073Hi Sally,
That is perfect. Try adding this code to the functions.php file in your theme/child theme directory – make sure to have a full server back-up first for safety. For more details you can check the safe coding guidelines.
Best,add_filter('asp_results', 'asp_my_custom_link_url', 10, 1); function asp_my_custom_link_url($results) { foreach ( $results as $k => &$r ) { if ( $r->content_type == 'attachment' ) { $r->link = get_post_meta( $r->id, '_gallery_link_url', true ); } } return $results; }
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
October 8, 2021 at 2:10 pm #35090Hi Ernest, thank you so much. I am thrilled to bits to see it all working as I want it to. At first it didn’t, as I was clicking on any image return, but quickly figured out I only have 10 test images with captions and descriptions, so this is really amazing! Thank you for your efforts in helping me resolve this issue.
But, I do have one more pressing issue I have noticed while testing search options and capabilities…
https://prnt.sc/1vav9he
Using the Autocomplete will directly trigger to search results (I have removed the Magnifier on search box – as search images are automatically displayed on typing…),Is there ANY WAY perhaps (and this is absolutely essential for finding relevant images) – that you could take a look at screenshot supplied – to see if you could include IMAGE CAPTIONS AND DESCRIPTIONS as SOURCES?
The reason I ask is because Google keywords is used as default – because I don’t think captions and descriptions are included in autocomplete…
This would really make the site super-powerful in terms of what we want to achieve, so any assistance with this would be much appreciated.Thanks once again Ernest. I am loving your product more and more as I get more familiar with it!
Kind regards,
SallyOctober 8, 2021 at 2:28 pm #35092Thank you for your kind words!
I’m afraid we can’t do the captions nor the descriptions. We had attempts to make a more powerful autocomplete by using post content and other fields, but there are many issues with that – some performance related and some others. Because how the plugin is priced and works (one time fee, and runs on your local server), there are some things we have to consider – especially performance related – before we add any new features. This is something we probably won’t be able to implement any time soon.
Best,
If the plugin was subscription based with on-demand usage and payment, we could basically do anything, as our servers could handle the queries. However the price could shoot up from hundreds of dollars to thousands per month – instead of the current very low one time license.
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
October 8, 2021 at 2:46 pm #35095Hi Ernest – thank you – and I understand completely. Is this then something that could be undertaken by an external WP developer – i.e WP-Kraken or others? Or would the cost of having this customised further likely to prove prohibitively expensive initially, at least until we have the budget for this kind of undertaking? Thanks for all your input.
Kind regards,
SallyOctober 8, 2021 at 2:51 pm #35098I think so, a decent developer could be able to handle it. The cost I honestly don’t know, it varies a lot. It could be worth asking, they may give you an estimate. Although I usually don’t recommend doing these kinds of customizations – as the first update will very likely break it completely.
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.