LLMS_Question_Manager::get_questions( string $return = 'questions' )
Get questions
Parameters Parameters
- $return
-
(string) (Optional) type of return [ids|posts|questions]
Default value: 'questions'
Return Return
(array)
Source Source
File: includes/class.llms.question.manager.php
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 | public function get_questions( $return = 'questions' ) { $query = new WP_Query( array ( 'meta_query' => array ( array ( 'key' => '_llms_parent_id' , 'value' => $this ->get_parent()->get( 'id' ), ), ), 'order' => 'ASC' , 'orderby' => 'menu_order' , 'post_status' => 'publish' , 'post_type' => 'llms_question' , 'posts_per_page' => 500, ) ); if ( 'ids' === $return ) { $ret = wp_list_pluck( $query ->posts, 'ID' ); } elseif ( 'posts' === $return ) { $ret = $query ->posts; } else { $ret = array (); foreach ( $query ->posts as $post ) { $ret [] = new LLMS_Question( $post ); } } return apply_filters( 'llms_quiz_get_questions' , $ret , $this , $return ); } |
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
3.3.0 | Introduced. |