WordPress.org

Ready to get started?Download WordPress

Forums

Reorder Posts
Reorder only the custom post types you want (8 posts)

  1. mathielo
    Member
    Posted 1 year ago #

    First of all, thanks a LOT for this plugin, it always worked for me and it's great: easy to install (developers) and easy to use (users).

    The only downside I have seen so far is that you can't pick which post types you want to reorder, by default all of them are "reordable".

    The solution for this problem, as provided in your FAQ is to extract the Reorder class from the plugin, therefore stopping using the plugin. Since I'm not fond of discrediting people for their hard word to make our lives easier (lol), I managed to add a single code line to the plugin so now I can chose which post types I want to apply reorder, still using the plugin.

    In the plugin's index.php file, at line 65 (under "mn_reorder_posts_init" function), I've added the following filter:
    $post_types = apply_filters( 'metronet_reorder_post_types', $post_types );

    So now whenever I want to specify which custom post types to reorder, I add this to my functions.php:

    add_filter('metronet_reorder_post_types', 'set_reorder');
    function set_reorder($post_types){
    	$post_types = array('my_custom_post_type', 'my_other_post_type');
    	return $post_types;
    }

    This was a fast implementation, not fail-proof and I'm sure there's a way to make it work a lot better, but that's working fine for me so far.

    Anyway, this is my suggestion to make the plugin better, hope you guys implement it some time! :)

    Best regards!

    http://wordpress.org/extend/plugins/metronet-reorder-posts/

  2. Ronald Huereca
    Member
    Plugin Author

    Posted 1 year ago #

    Thanks for the suggestion! We'll see if we have time to put it in. Should be simple, but there's a lot on our plates this week.

  3. Ryan Hellyer
    Member
    Plugin Author

    Posted 1 year ago #

    When I was setting up the class for this, I intentionally made it in a way that made it (hopefully) simple to extract and use in individual projects for situations like this.

    However, your suggestion actually seems a lot better since upgrading the plugin would keep the functionality updating, whilst still keeping all your existing functionality.

    So in a nutshell ... we should do this, but in the mean time I suggest abstracting the class out and using it directly. I used it earlier this week to do exactly this. I just placed the class into my theme and instantiated it via the functions.php file (you can set which post-types to reorder whilst instantiating it).

  4. Ryan Hellyer
    Member
    Plugin Author

    Posted 1 year ago #

    Oops, I only skim read your original post. It seems you already knew about abstracting the class!

    Thanks for the suggestion :) Either Ronald or I will probably implement this some time in the next few weeks. As Ronald mentioned, we're a bit busy at the moment so can't spare much time right now.

  5. mathielo
    Member
    Posted 1 year ago #

    I'm glad you guys enjoyed my suggestion! Let me know if there's any way I can help :)

  6. Ryan Hellyer
    Member
    Plugin Author

    Posted 1 year ago #

    It's one of the better suggestions I've seen in a while :) In my experience, people usually ask for bloatware to be added to plugins :/

  7. mathielo
    Member
    Posted 1 year ago #

    Yeah! I see you guys updated the plugin, adding the new filter! Glad to know I could help!

    Thanks for the mention! =D

  8. Ryan Hellyer
    Member
    Plugin Author

    Posted 1 year ago #

    Oops, I meant to post back here once it was updated, but I guess I forgot!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic