WordPress.org

Ready to get started?Download WordPress

Forums

Eazyest Gallery
Media items manual sorting not working in admin (1 post)

  1. klihelp
    Member
    Plugin Author

    Posted 1 year ago #

    Saving/updating the folder post details in admin, the media attachment manual ordering isn't updated.

    // Quick fix in class-eazyest-folderbase.php, save_attachments() function
    
    $reordered = isset( $_POST['gallery-changed-media'] ) && $_POST['gallery-changed-media'];
    
    // add an if section before foreach( $_POST['attachment']
    // $_POST['attachment'] missing ..
    // get the media list form  $_POST['gallery-order-media']
    //
    if ( $reordered && ! isset($_POST['attachment']) ) {
    
    	$_POST['attachment'] = explode(' ', $_POST['gallery-order-media']);
    
    	foreach( $_POST['attachment'] as $item_id ) {
    
    		$attachment = get_post( $item_id );
    		$attachment->menu_order = array_search( $attachment->ID, explode( ' ', $_POST['gallery-order-media'] ) );
    
    		wp_update_post( $attachment );
    	}
    
    }

    Using

    http://wordpress.org/extend/plugins/eazyest-gallery/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic