bbp_forum_get_subforums( array $args = array() )
Return subforums of given forum
Description Description
Parameters Parameters
- $args
-
(Optional) All the arguments supported by WP_Query
Default value: array()
Return Return
(mixed) false if none, array of subs if yes
Source Source
File: includes/forums/template.php
function bbp_forum_get_subforums( $args = array() ) { // Default return value $retval = array(); // Use passed integer as post_parent if ( is_numeric( $args ) && ! empty( $args ) ) { $args = array( 'post_parent' => bbp_get_forum_id( $args ) ); } // Parse arguments against default values $r = bbp_parse_args( $args, array( 'post_parent' => 0, 'post_type' => bbp_get_forum_post_type(), 'posts_per_page' => get_option( '_bbp_forums_per_page', 50 ), 'orderby' => 'menu_order title', 'order' => 'ASC', 'ignore_sticky_posts' => true, 'no_found_rows' => true ), 'forum_get_subforums' ); // Ensure post_parent is properly set $r['post_parent'] = bbp_get_forum_id( $r['post_parent'] ); // Query if post_parent has subforums if ( ! empty( $r['post_parent'] ) && bbp_get_forum_subforum_count( $r['post_parent'], true ) ) { $get_posts = new WP_Query(); $retval = $get_posts->query( $r ); } // Filter & return return (array) apply_filters( 'bbp_forum_get_subforums', $retval, $r, $args ); }
Changelog Changelog
Version | Description |
---|---|
2.0.0 | Introduced. |