Support » Plugin: BuddyPress Docs » Hierarchization of documents

  • Resolved musatge

    (@musatge)



    WordPress Version: 4.9.8
    PHP Version: 7.0.31
    Theme : Community Builder
    Extensions : bbPress, BuddyDev Dashboard, BuddyPress, BuddyPress Ajax Registration, Classic Editor, Code Snippets, List Pages Shortcode, Loco Translate, Maximus Page Builder, Post Type Switcher, SysInfo, WP Sitemap Page

    Hello
    When the documents are hierarchized, it looks like this:
    Documents enfants :Nam quibusdam, Quam ob rem
    with the p tag, and I would like the child documents to be in the form of an ordered list.
    How to do ? Thank you

Viewing 1 replies (of 1 total)
  • Plugin Author David Cavins

    (@dcavins)

    Hi @musatge-

    You could use the bp_docs_hierarchy_show_children filter. Something like this would get pretty close:

    
    add_filter( 'bp_docs_hierarchy_show_children', function( $html, $child_data ) {
    	if ( !empty( $child_data ) ) {
    		$html = '<h4>' . __( 'Children: ', 'buddypress-docs' ) . '</h4>';
    		$html .= '<ul>';
    
    		$children_html = array();
    		foreach( $child_data as $child ) {
    			$children_html[] = '<li><a href="' . $child['post_link'] . '">' . $child['post_name'] . '</a></li>';
    		}
    
    		$html .= implode( ' ', $children_html );
    
    		$html .= '</ul>';
    	}
    	return $html;
    }, 10, 2 );
    
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.