Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator bcworkz

    (@bcworkz)

    The solution in the other topic is only relevant if you use the exact same theme and version. However, some sort of problem with your theme or plugins is probable. Try deactivating all plugins and switching to a default twenty* theme. Grid view should again be accessible. If so, restore your theme and plugins, one at a time, until the problem returns. The last activated module would be the cause.

    Thread Starter joppedi

    (@joppedi)

    Thanks for sorting things out for me.
    Now I have found what caused the problem:
    I had a snippet in child themes functions.php (to make an event calendar′s past events to get listed in reverse order). I guess it had to do with using ajax?

    function tribe_past_reverse_chronological ($post_object) {
    
    	$past_ajax = (defined( 'DOING_AJAX' ) && DOING_AJAX && $_REQUEST['tribe_event_display'] === 'past') ? true : false;
    
    	if(tribe_is_past() || $past_ajax) {
    		$post_object = array_reverse($post_object);
    	}
    
    	return $post_object;
    }
    add_filter('the_posts', 'tribe_past_reverse_chronological', 100);
    Moderator bcworkz

    (@bcworkz)

    I don’t think the list table view (upload.php) uses Ajax, but the media library modal in the editor certainly does. I’m unclear why tribe_event_display is in the mix for the media library, but there’s the rub. I’m only able to observe default behavior. Themes and plugins can alter behavior, so nearly anything is possible.

    I also don’t see why reversing a list of post objects would completely prevent the grid display, but reversing in the wrong context is still wrong even if it didn’t corrupt the display. It seems you need better criteria for when to apply the reversal. Your callback can collect the entire WP_Query object as the second hook parameter. There is likely some unique combination of query vars you could use to confirm that list reversal is appropriate.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Media Library in Grid view not visible’ is closed to new replies.