Custom Code Needed For Nested Replies
I’m trying to make my own nested threaded replies. Right now all the replies appear in my page, but there’s no organization to them. Is the $args method the way to go or do I need to make my own custom sql statement? I’ve got all the data in the args below, but the sort isn’t nested. Not sure how do do that.
$args = array( 'post_type' => 'reply', // custom post type 'posts_per_page' => '50', 'orderby' => 'post_parent', 'post_parent' => $topic_id, 'meta_query' => array( 'relation' => 'OR', array( 'key'=> $topic_id, ), array( 'key'=>'_bbp_reply_to', 'compare' => 'NOT EXISTS' ), array( 'key'=>'_bbp_reply_to', 'compare' => 'EXISTS', ), ), 'orderby' => 'meta_value_num', 'order' => 'ASC', ); //global $wpdb; $loopReply = new WP_Query($args);
- You must be logged in to reply to this topic.