WordPress.org

Ready to get started?Download WordPress

Forums

Code Snippets
Changing the list order of snippets? (6 posts)

  1. GermanKiwi
    Member
    Posted 8 months ago #

    Hi Shea, what do you think about the idea of allowing the order of the snippets (on the Manage page) to be changed? Maybe by dragging-and-dropping them up and down?

    I know this wouldn't make any functional difference in terms of how the snippets actually work, but it would make it a bit easier to manage a larger number of snippets, by grouping similar or related snippets next to each other in the list.

    Eg. I have several snippets which add or modify things to the <head> section of my webpages, and it would be handy for me if I could have those snippets sitting right next to each other on the Manage page, so I don't have to scroll up and down to find them all.

    Of course I don't know how big a deal it would be to implement something like this... :)

    http://wordpress.org/plugins/code-snippets/

  2. Shea Bunge
    Member
    Plugin Author

    Posted 8 months ago #

    This is a good idea - I'll see what I can do. Perhaps the snippets could also be executed in the order that they are placed in as well.

  3. GermanKiwi
    Member
    Posted 8 months ago #

    FWIW, I've used another plugin called Simple Page Ordering which allows the order of Pages to be changed via a very useful drag-n-drop method. Maybe the same method (same code?) could work with your plugin.

    In what order to the snippets currently execute? And what would be the consequence of changing the order based on the order they are placed? I hadn't considered this aspect.

  4. Shea Bunge
    Member
    Plugin Author

    Posted 8 months ago #

    I've used Simple Page Ordering before as well, and it came to mind when thinking about how to implement this. I might have a look at SPO's JavaScript code for dragging and dropping the pages and use something like that.

    Snippets are currently executed in the order they are retrieved from the database - this would usually be the order they are added to the database. Changing the order probably wouldn't make a lot of difference, as snippets tend to be mostly isolated, but it would make sense to have a bit of reason to the order they are executed.

  5. GermanKiwi
    Member
    Posted 8 months ago #

    Sounds good to me! :)

  6. Surbma
    Member
    Posted 8 months ago #

    This is a very good idea to let us set the order of the snippets, they are executed.

    For the original question by GermanKiwi: I would recommend to have custom taxonomy, so we can put snippets to categories and we can list them by category as well.

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.