Viewing 10 replies - 1 through 10 (of 10 total)
  • Also I vote for this feature.

    Thanks for Code Mirror – is much better than previous editor!

    Plugin Author Shea Bunge

    (@bungeshea)

    I’m working on adding a few new features to the Manage Snippets page; sorting by name will be one of them.

    Plugin Author Shea Bunge

    (@bungeshea)

    With version 1.5 comes the ability to sort snippets by name by clicking on the column header.

    To sort by ID again, click on the ‘Screen Options’ tab in the top-right corner, check the ‘ID’ checkbox and then click on the header of the ID column. You can also sort descending by clicking on the column header again.

    great plugin! just discovered the other day. do you plan to further enhance the sorting functionality? currently, if you sort by the name column, select a snippet, and then go back to the list, your previous sort is gone. given the number of snippets i have on my site (and i am basically prefixing the name with a “category”), i would love to have a sorting option that is more persistent.

    Plugin Author Shea Bunge

    (@bungeshea)

    Persistent sorting isn’t a usual feature of WordPress admin tables. I suppose that it may be possible to save your sorting preferences to your user profile in the WordPress database, just like the snippets per page option. But, as I said, doing this wouldn’t be consistent with other WordPress administration areas.

    Something else to keep in mind is that I may be introducing “tags” or “categories” for snippets sometime in the future.

    i guess i was thinking more of adding an option to the plugin to sort by ID or sort by snippet name. tags and categories would be very helpful as well. thank you.

    Plugin Author Shea Bunge

    (@bungeshea)

    You can sort by name by clicking on the ‘Name’ column label. It is the same for the ID column.

    If the ID column is not visible, you can show it by clicking on the ‘Screen Options’ tab in the top-right corner and checking the checking the ‘ID’ checkbox.

    Tom Braider

    (@tom-braider)

    simply change class-list-table.php line 351 to
    $orderby = ( ! empty($_REQUEST['orderby'] ) ) ? $_REQUEST['orderby'] : 'name';
    to order by ‘name’ by default ??

    Plugin Author Shea Bunge

    (@bungeshea)

    With Code Snippets 1.6 and later, you can alter the default order by value using the code_snippets_default_orderby filter hook. This means that there is no need to use Tom Braider’s solution anymore.

    Here is a code snippet that will set the default snippet order to name instead of id:

    function my_default_snippets_order( $orderby ) {
    	return 'name';
    }
    add_filter( 'code_snippets_default_orderby', 'my_default_snippets_order' );

    You can add the above snippet to a custom plugin, your functions.php file, or as a code snippet through the Snippets admin menu.

    Plugin Author Shea Bunge

    (@bungeshea)

    In Code Snippets 1.8 the hook name has changed for setting the default snippet orderby. The above solution will no longer work.

    Instead see https://code-snippets.bungeshea.com/docs/snippets-default-orderby/ for details on how to make snippets order by name by default

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘[Plugin: Code Snippets] Suggestion – Sort by Snippet Name’ is closed to new replies.