Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Media file search issue
- This topic has 6 replies, 2 voices, and was last updated 2 years, 6 months ago by
NormanGaba.
-
AuthorPosts
-
November 26, 2023 at 6:32 pm #46185
NormanGaba
ParticipantHi! I have an issue using the media search feature. I need to search in media files based on tags and categories. But is it possible to filter the gallery dynamically instead of showing the media files as result? Because if I click on a result, it opens the image following the image link and it isn’t a good solution for me.
It would be great if the gallery is filtering itself based on the searched term. Is this possible? Or is there another solution to this?
Thank you!
November 27, 2023 at 2:05 pm #46199Ernest Marcinko
KeymasterHi,
I assume the galleries are some sort of a custom post type on their own? It is probably not possible, because the categories are likely connected to the actual media files and not to the galleries.
November 27, 2023 at 3:10 pm #46211NormanGaba
ParticipantHi Ernest, the gallery is a Divi Masonry Gallery module, taking images from media files. Is there maybe a way to display image results in a better way other than following the direct link? Maybe opening lightbox?
Thank you!
November 28, 2023 at 12:53 pm #46216Ernest Marcinko
KeymasterI’m afraid for that is not possible without some custom coding. You can however changet he file link to direct to the parent post (where it was uploaded to): https://i.imgur.com/5TrRc2t.png
November 29, 2023 at 10:14 pm #46243NormanGaba
ParticipantYou cannot access this content.
November 30, 2023 at 11:28 am #46253Ernest Marcinko
KeymasterWell, it should not be too difficult, but you need a lightbox script. I found a ready made test solution in a previous thread:
add_action('wp_footer', 'asp_custom_footer_script', 99999); function asp_custom_footer_script() { ?> <style> .asp_r { z-index: 10 !important; } </style> <script> var s = document.createElement( 'script' ); s.setAttribute( 'src', 'https://unpkg.com/[email protected]/dist/simple-lightbox.js' ); document.body.appendChild( s ); s = document.createElement( 'link' ); s.setAttribute( 'rel', 'stylesheet' ); s.setAttribute( 'href', 'https://unpkg.com/[email protected]/dist/simple-lightbox.css' ); document.body.appendChild( s ); jQuery(function($){ $('.asp_m').on('asp_results_show', function(){ new SimpleLightbox('.asp_r .item a', { /* options */ }); }); }); </script> <?php }Try adding this code via the Code Snippets plugin or 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.
Please keep in mind, that this is a test code only, the files should be self-hosted and some other checks may be required.
Unfortunately I am not available for custom jobs, I am sorry.
November 30, 2023 at 12:11 pm #46256NormanGaba
ParticipantThank you so much for your help Ernest, i will try it out.
Have a nice day!
-
AuthorPosts
- You must be logged in to reply to this topic.