166 * @see _walk_bookmarks() |
166 * @see _walk_bookmarks() |
167 * |
167 * |
168 * @param string|array $args { |
168 * @param string|array $args { |
169 * Optional. String or array of arguments to list bookmarks. |
169 * Optional. String or array of arguments to list bookmarks. |
170 * |
170 * |
171 * @type string $orderby How to order the links by. Accepts post fields. Default 'name'. |
171 * @type string $orderby How to order the links by. Accepts post fields. Default 'name'. |
172 * @type string $order Whether to order bookmarks in ascending or descending order. |
172 * @type string $order Whether to order bookmarks in ascending or descending order. |
173 * Accepts 'ASC' (ascending) or 'DESC' (descending). Default 'ASC'. |
173 * Accepts 'ASC' (ascending) or 'DESC' (descending). Default 'ASC'. |
174 * @type int $limit Amount of bookmarks to display. Accepts 1+ or -1 for all. |
174 * @type int $limit Amount of bookmarks to display. Accepts 1+ or -1 for all. |
175 * Default -1. |
175 * Default -1. |
176 * @type string $category Comma-separated list of category IDs to include links from. |
176 * @type string $category Comma-separated list of category IDs to include links from. |
177 * Default empty. |
177 * Default empty. |
178 * @type string $category_name Category to retrieve links for by name. Default empty. |
178 * @type string $category_name Category to retrieve links for by name. Default empty. |
179 * @type int|bool $hide_invisible Whether to show or hide links marked as 'invisible'. Accepts |
179 * @type int|bool $hide_invisible Whether to show or hide links marked as 'invisible'. Accepts |
180 * 1|true or 0|false. Default 1|true. |
180 * 1|true or 0|false. Default 1|true. |
181 * @type int|bool $show_updated Whether to display the time the bookmark was last updated. |
181 * @type int|bool $show_updated Whether to display the time the bookmark was last updated. |
182 * Accepts 1|true or 0|false. Default 0|false. |
182 * Accepts 1|true or 0|false. Default 0|false. |
183 * @type int|bool $echo Whether to echo or return the formatted bookmarks. Accepts |
183 * @type int|bool $echo Whether to echo or return the formatted bookmarks. Accepts |
184 * 1|true (echo) or 0|false (return). Default 1|true. |
184 * 1|true (echo) or 0|false (return). Default 1|true. |
185 * @type int|bool $categorize Whether to show links listed by category or in a single column. |
185 * @type int|bool $categorize Whether to show links listed by category or in a single column. |
186 * Accepts 1|true (by category) or 0|false (one column). Default 1|true. |
186 * Accepts 1|true (by category) or 0|false (one column). Default 1|true. |
187 * @type int|bool $show_description Whether to show the bookmark descriptions. Accepts 1|true or 0|false. |
187 * @type int|bool $show_description Whether to show the bookmark descriptions. Accepts 1|true or 0|false. |
188 * Default 0|false. |
188 * Default 0|false. |
189 * @type string $title_li What to show before the links appear. Default 'Bookmarks'. |
189 * @type string $title_li What to show before the links appear. Default 'Bookmarks'. |
190 * @type string $title_before The HTML or text to prepend to the $title_li string. Default '<h2>'. |
190 * @type string $title_before The HTML or text to prepend to the $title_li string. Default '<h2>'. |
191 * @type string $title_after The HTML or text to append to the $title_li string. Default '</h2>'. |
191 * @type string $title_after The HTML or text to append to the $title_li string. Default '</h2>'. |
192 * @type string $class The CSS class to use for the $title_li. Default 'linkcat'. |
192 * @type string|array $class The CSS class or an array of classes to use for the $title_li. |
193 * @type string $category_before The HTML or text to prepend to $title_before if $categorize is true. |
193 * Default 'linkcat'. |
194 * String must contain '%id' and '%class' to inherit the category ID and |
194 * @type string $category_before The HTML or text to prepend to $title_before if $categorize is true. |
195 * the $class argument used for formatting in themes. |
195 * String must contain '%id' and '%class' to inherit the category ID and |
196 * Default '<li id="%id" class="%class">'. |
196 * the $class argument used for formatting in themes. |
197 * @type string $category_after The HTML or text to append to $title_after if $categorize is true. |
197 * Default '<li id="%id" class="%class">'. |
198 * Default '</li>'. |
198 * @type string $category_after The HTML or text to append to $title_after if $categorize is true. |
199 * @type string $category_orderby How to order the bookmark category based on term scheme if $categorize |
199 * Default '</li>'. |
200 * is true. Default 'name'. |
200 * @type string $category_orderby How to order the bookmark category based on term scheme if $categorize |
201 * @type string $category_order Whether to order categories in ascending or descending order if |
201 * is true. Default 'name'. |
202 * $categorize is true. Accepts 'ASC' (ascending) or 'DESC' (descending). |
202 * @type string $category_order Whether to order categories in ascending or descending order if |
203 * Default 'ASC'. |
203 * $categorize is true. Accepts 'ASC' (ascending) or 'DESC' (descending). |
|
204 * Default 'ASC'. |
204 * } |
205 * } |
205 * @return void|string Void if 'echo' argument is true, HTML list of bookmarks if 'echo' is false. |
206 * @return void|string Void if 'echo' argument is true, HTML list of bookmarks if 'echo' is false. |
206 */ |
207 */ |
207 function wp_list_bookmarks( $args = '' ) { |
208 function wp_list_bookmarks( $args = '' ) { |
208 $defaults = array( |
209 $defaults = array( |
232 |
233 |
233 if ( ! is_array( $parsed_args['class'] ) ) { |
234 if ( ! is_array( $parsed_args['class'] ) ) { |
234 $parsed_args['class'] = explode( ' ', $parsed_args['class'] ); |
235 $parsed_args['class'] = explode( ' ', $parsed_args['class'] ); |
235 } |
236 } |
236 $parsed_args['class'] = array_map( 'sanitize_html_class', $parsed_args['class'] ); |
237 $parsed_args['class'] = array_map( 'sanitize_html_class', $parsed_args['class'] ); |
237 $parsed_args['class'] = trim( join( ' ', $parsed_args['class'] ) ); |
238 $parsed_args['class'] = trim( implode( ' ', $parsed_args['class'] ) ); |
238 |
239 |
239 if ( $parsed_args['categorize'] ) { |
240 if ( $parsed_args['categorize'] ) { |
240 $cats = get_terms( |
241 $cats = get_terms( |
241 array( |
242 array( |
242 'taxonomy' => 'link_category', |
243 'taxonomy' => 'link_category', |