• Resolved digbymaass

    (@digbymaass)


    Some time ago you created this very useful bit of code (which goes in functions.php) to display the tables in the dashboard newest first –

    // change default order in Tablepress to newest first
    add_filter( 'tablepress_load_class_name', 'tp_change_default_order_in_list' );
    function tp_change_default_order_in_list( $class ) {
    	if ( 'TablePress_List_View' === $class ) {
    		if ( empty( $_GET['orderby'] ) && empty( $_GET['order'] ) ) {
    			$_GET['orderby'] = 'id';
    			$_GET['order'] = 'desc';
    		}
    	}
    	return $class;
    }

    Now we have 90 tables, and that list grows all the time, the drop down selectors on the ‘import’ and ‘export’ pages are taking a long time to scroll down to the new tables. And of course it is always those that we might import or export to.

    Is it possible to adapt the above code to display these newest first as well? Or is there another method?

    Thank you for your excellent work and plugin!

    https://www.ads-software.com/plugins/tablepress/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter digbymaass

    (@digbymaass)

    Or if not newest first, highest ID first, since they are listed by ID.

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    thanks for your question, and sorry for the trouble.

    For this, you could try this line of code in the “functions.php”

    add_filter( 'tablepress_load_all_tables', 'array_reverse' );

    It should show the lists with the highest IDs first.

    Regards,
    Tobias

    Thread Starter digbymaass

    (@digbymaass)

    And it does! Thank you!

    May I suggest building newest first into TablePress as the default? Or giving it as an option?

    I’ve never understood why so many plugins use oldest first. It’s perverse!

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    good to hear that this helps! ??

    Yeah, I see what you mean… I’ll have to think about that…

    Best wishes,
    Tobias

    P.S.: In case you haven’t, please rate TablePress here in the plugin directory. Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Import & export drop down menus – newest first’ is closed to new replies.