Home Forums Plugin Support WP Project Manager Pro Order of To-do Lists in Milestones

This topic is: not resolved

This topic contains 2 replies, has 2 voices, and was last updated by  Taylor 5 years, 1 month ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #17720

    Taylor
    Member
    Post count: 1

    How is the order of To-do Lists determined in Milestones? I am trying to put them in a specific order but I cannot seem to do so. I have reordered the To-do lists in the To-do lists tab, changed the start dates of the To-do items, and numbered the titles of the To-do lists, but nothing seems to work. Are the To-do lists ordered by the date they were created (probably by id)? I really need a way to change the order of To-do lists in Milestones. Thanks for your help!

    #17770

    Nizam Uddin
    Keymaster
    Post count: 670

    Thank you Taylor. We will add it to our feature list..

    #17810

    Taylor
    Member
    Post count: 1

    Below is a possible solution. I set the list of To-dos in Milestones to be displayed in order of the sort order configured in the To-Do Lists tab in the backend. I added the ‘orderby' parameter to the $args array. It would be great if you committed this to the code ๐Ÿ™‚

    /**
    * Get all tasks based on a milestone
    *
    * @param int $list_id
    * @return object object array of the result set
    */
    function get_tasklist_by_milestone( $milestone_id, $privacy = false ) {
    $args = array(
    ‘post_type' => ‘task_list',
    ‘numberposts' => -1,
    ‘orderby' => ‘menu_order',
    ‘order' => ‘ASC'
    );

    $args[‘meta_query'][] = array(
    ‘key' => ‘_milestone',
    ‘value' => $milestone_id,
    ‘orderby' => ‘menu_order',
    ‘order' => ‘ASC'
    );

    if ( $privacy === false ) {
    $args[‘meta_query'][] = array(
    ‘key' => ‘_tasklist_privacy',
    ‘value' => ‘yes',
    ‘compare' => ‘!=',
    ‘orderby' => ‘menu_order',
    ‘order' => ‘ASC'
    );
    }

    $tasklists = get_posts( $args );
    foreach ($tasklists as $list) {
    $this->set_list_meta( $list );
    }
    return $tasklists;
    }

Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘Order of To-do Lists in Milestones’ is closed to new replies.