Support » Plugin: Shortcodes Ultimate » Slider – Code Suggestion

  • Hi,

    First, thanks for a great plugin that I’ve used on many sites for several years.

    I’ve had an ongoing problem with the slider though. When you do a tax query, it defaults to only searching for posts, and so if there are custom posts with that taxonomy tag, they aren’t returned. This can be quickly fixed by editing the files shortcodes-ultimate/inc/core/tools.php on line 718 or so to change:

    // Source: taxonomy
    		elseif ( $args['source']['type'] === 'taxonomy' ) {
    			// Parse taxonomy name and terms ids
    			$args['source']['val'] = explode( '/', $args['source']['val'] );
    			// Taxonomy parsed incorrectly, return empty array
    			if ( !is_array( $args['source']['val'] ) || count( $args['source']['val'] ) !== 2 ) return $slides;
    			$query['tax_query'] = array(
    				array(
    					'taxonomy' => $args['source']['val'][0],
    					'field' => 'id',
    					'terms' => (array) explode( ',', $args['source']['val'][1] )
    				)
    			);
    		}

    to

    // Source: taxonomy
    		elseif ( $args['source']['type'] === 'taxonomy' ) {
    			// Parse taxonomy name and terms ids
    			$args['source']['val'] = explode( '/', $args['source']['val'] );
    			// Taxonomy parsed incorrectly, return empty array
    			if ( !is_array( $args['source']['val'] ) || count( $args['source']['val'] ) !== 2 ) return $slides;
    			$query['tax_query'] = array(
    				array(
    					'taxonomy' => $args['source']['val'][0],
    					'field' => 'id',
    					'terms' => (array) explode( ',', $args['source']['val'][1] )
    				)
    			);
    			$query['post_type'] = 'any';
    		}

    https://wordpress.org/plugins/shortcodes-ultimate/

  • The topic ‘Slider – Code Suggestion’ is closed to new replies.