• Hello again,

    I’ve got one other quick question regarding the ‘completed’ shortcode parameter for [todolist]:

    I was wanting to display a list of just the completed items, so I used the following shortcode

    [todolist title=”Completed Tasks” completed=”show”]

    My completed tasks are showing, but only underneath a list of uncompleted tasks. Is it possible to only show completed tasks?

    https://www.ads-software.com/extend/plugins/cleverness-to-do-list/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Cindy Kendrick

    (@elusivelight)

    No, not currently. I do have that on my feature request list though.

    Thread Starter hardcore253

    (@hardcore253)

    Firstly, thank you again for the response and glad to hear it is on the feature list for next update!

    Second – I actually figured out a way to get it to work – albeit a bit dirty.

    I opened the file: cleverness-to-do-list-frontend.class.php

    and found the section where the todolist shortcode parameters are read, and then the loop called to find all the items. Then I modified the code to look like this

    /** @var $category mixed */
    		if ( $category == 'all' ) $category = '0';
    		list( $this->url, $this->action ) = CTDL_Lib::set_variables();
    
    				/** @var $completed string */
    		if ( $completed == 'show' ) {
    
    					wp_reset_postdata();
    
    					if ( $type == 'table' ) {
    
    						$this->list .= '<table id="todo-list-completed" class="todo-table">';
    						/** @var $completed_title string */
    						if ( $completed_title != '' ) $this->list .= '<caption>'.$completed_title.'</caption>';
    						$this->show_table_headings( 1 );
    						$this->loop_through_todos( 1, $category );
    						$this->list .= '</table>';
    
    					} elseif ( $type == 'list' ) {
    
    						/** @var $completed_title string */
    						if ( $completed_title != '') {
    							$this->list .= '<h3 class="todo-title">'.esc_html( $completed_title ).'</h3>';
    						}
    						$this->list .= '<'.$list_type.' class="todolist">';
    						$this->loop_through_todos( 1, $category );
    						$this->list .= '</'.$list_type.'>';
    
    					}
    
    		}
    		/** @var $type string */
    		elseif ( $type == 'table' ) {
    
    			$this->list .= '<table id="todo-list" class="todo-table">';
    			/** @var $title string */
    			if ( $title != '' ) $this->list .= '<caption>'.$title.'</caption>';
    			$this->show_table_headings();
    			$this->loop_through_todos( 0, $category );
    			$this->list .= '</table>';
    
    		} elseif ( $type == 'list' ) {
    
    			/** @var $title string */
    			if ( $title != '') {
    				$this->list .= '<h3 class="todo-title">'.esc_html( $title ).'</h3>';
    			}
    			/** @var $list_type string */
    			$this->list .= '<'.$list_type.' class="todolist">';
    			$this->loop_through_todos( 0, $category );
    			$this->list .= '</'.$list_type.'>';
    
    		}
    
    		/** @var $completed string */

    So if the completed parameter is set to “show” it will only ever show completed items, otherwise, it will show all outstanding items. Like I said, dirty, but it gets the job done for how I’ll be using it until you update.

    Not sure how you plan to implement a feature like this, but I know some folks will want to show ALL to-do’s separated by uncomplete and completed as it currently works, and some will only want to show one or just the other – so maybe add one more parameter with a 0,1,2 value to drive if all items shown (0), just uncompleted (1) and just completed (2)?

    Thanks again!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Plugin: Cleverness To-Do List] Displaying only completed items’ is closed to new replies.