Media file search issue

This topic contains 6 replies, has 2 voices, and was last updated by NormanGaba NormanGaba 7 months, 3 weeks ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #46185
    NormanGaba
    NormanGaba
    Participant

    Hi! 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!

    #46199
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi,

    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.

    Best,
    Ernest Marcinko

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


    #46211
    NormanGaba
    NormanGaba
    Participant

    Hi 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!

    #46216
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    I’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

    Best,
    Ernest Marcinko

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


    #46243
    NormanGaba
    NormanGaba
    Participant
    You cannot access this content.
    #46253
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Well, 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.

    Best,
    Ernest Marcinko

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


    #46256
    NormanGaba
    NormanGaba
    Participant

    Thank you so much for your help Ernest, i will try it out.

    Have a nice day!

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.