• Resolved serpher

    (@serpher)


    I’m using Media Library Assistant for custom taxonomy and it works for su_carousel but not for su_image_carousel.

    HTML:

    [su_image_carousel source=”taxonomy: attachment_category/89″ columns=”2″ link=”lightbox”]

    functions.php

    add_filter( ‘su/get_gallery_slides_query’, function( $query, $source, $args ) {

    // Replace ‘media_category’ with your taxonomy name
    if ( ‘attachment_category’ === $source[‘tax’] ) {
    $query[‘post_mime_type’] = ‘image/jpeg,image/gif,image/jpg,image/png’;
    $query[‘post_type’] = ‘attachment’;
    $query[‘post_status’] = ‘inherit’;
    }

    return $query;

    } );

    (also tried “attachment_category/89”)

    Website result:

    ArgumentCountError thrown

    Too few arguments to function {closure}(), 1 passed in C:\wamp64\www\wp-includes\class-wp-hook.php on line 288 and exactly 3 expected

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Vova

    (@gn_themes)

    Hi @serpher,

    please use the following snippet instead:

    add_filter( 'su/get_gallery_slides_query', function( $query, $source, $args ) {
    
    	if ( 'attachment_category' === $source['tax'] ) {
    		$query['post_mime_type'] = 'image/jpeg,image/gif,image/jpg,image/png';
    		$query['post_type']      = 'attachment';
    		$query['post_status']    = 'inherit';
    	}
    
    	return $query;
    
    }, 10, 3 );
    Thread Starter serpher

    (@serpher)

    Works like a charm! Thank you so much Vladimir! ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘su_image_carousel support for custom taxonomy’ is closed to new replies.