Forums

Add Custom Drop Down Media Filter (1 post)

  1. Dan77904
    Member
    Posted 5 months ago #

    I am trying to add filter criteria to the media upload window (the drop down list that normally filters attachments by month) that shows all images whose names contain the substring "icon". Here's the existing code for the filter, but I'm having trouble altering it to do what I want it to do. Any help would be LIFESAVING!

    <?php
    foreach ($arc_result as $arc_row) {
    	if ( $arc_row->yyear == 0 )
    		continue;
    	$arc_row->mmonth = zeroise( $arc_row->mmonth, 2 );
    
    	if ( isset($_GET['m']) && ( $arc_row->yyear . $arc_row->mmonth == $_GET['m'] ) )
    		$default = ' selected="selected"';
    	else
    		$default = '';
    
    	echo "<option$default value='" . esc_attr( $arc_row->yyear . $arc_row->mmonth ) . "'>";
    	echo esc_html( $wp_locale->get_month($arc_row->mmonth) . " $arc_row->yyear" );
    	echo "</option>\n";
    }
    ?>
    </select>
    <?php } ?>
    
    <?php submit_button( __( 'Filter »' ), 'secondary', 'post-query-submit', false ); ?>

Reply

You must log in to post.

About this Topic