static function getSubsections( $id ) {
		$parent = get_post( $id );
		if ( empty( $parent ) ) {
			return false;
		}
		$has_shortcode = has_shortcode( $parent->post_content, 'heading' );
		if ( stripos( $parent->post_content, '<h1' ) === false && $has_shortcode === false ) { // No <h1> or [heading] shortcode
			return false;
		}

		$type = $parent->post_type;
		$content = ( $has_shortcode ) ? apply_filters( 'the_content', $parent->post_content ) : $parent->post_content; // Only render shortcodes if we have to
		$content = strip_tags( $content, '<h1>' );  // Strip everything except h1 to speed up load time
		$output = [];
		$s = 1;

		$doc = new HtmlParser( true ); // Because we are not saving, use internal parser to speed up load time
		$dom = $doc->loadHTML( $content );
		$sections = $dom->getElementsByTagName( 'h1' );
		foreach ( $sections as $section ) {
			/** @var $section \DOMElement */
			$output[ $type . '-' . $id . '-section-' . $s ] = wptexturize( $section->textContent );
			$s++;
		}

		if ( empty( $output ) ) {
			return false;
		}

		return $output;
	}
static function getSubsections( $id ) {
		$parent = get_post( $id );
		if ( empty( $parent ) ) {
			return false;
		}
		$has_shortcode = has_shortcode( $parent->post_content, 'heading' );
		if ( stripos( $parent->post_content, '<h1' ) === false && $has_shortcode === false ) { // No <h1> or [heading] shortcode
			return false;
		}

		$type = $parent->post_type;
		$content = ( $has_shortcode ) ? apply_filters( 'the_content', $parent->post_content ) : $parent->post_content; // Only render shortcodes if we have to
		$content = strip_tags( $content, '<h1>' );  // Strip everything except h1 to speed up load time
		$output = [];
		$s = 1;

		$doc = new HtmlParser( true ); // Because we are not saving, use internal parser to speed up load time
		$dom = $doc->loadHTML( $content );
		$sections = $dom->getElementsByTagName( 'h1' );
		foreach ( $sections as $section ) {
			/** @var $section \DOMElement */
			$output[ $type . '-' . $id . '-section-' . $s ] = wptexturize( $section->textContent );
			$s++;
		}

		if ( empty( $output ) ) {
			return false;
		}

		return $output;
	}
static function getSubsections ( $ id ) { $ parent = get_post ( $ id ) ; if ( empty ( $ parent ) ) { return false ; } $ has_shortcode = has_shortcode ( $ parent -> post_content , 'heading' ) ; if ( stripos ( $ parent -> post_content , '<h1' ) === false && $ has_shortcode === false ) { // No <h1> or [heading] shortcode return false ; } $ type = $ parent -> post_type ; $ content = ( $ has_shortcode ) ? apply_filters ( 'the_content' , $ parent -> post_content ) : $ parent -> post_content ; // Only render shortcodes if we have to $ content = strip_tags ( $ content , '<h1>' ) ; // Strip everything except h1 to speed up load time $ output = [ ] ; $ s = 1 ; $ doc = new HtmlParser ( true ) ; // Because we are not saving, use internal parser to speed up load time $ dom = $ doc -> loadHTML ( $ content ) ; $ sections = $ dom -> getElementsByTagName ( 'h1' ) ; foreach ( $ sections as $ section ) { /** @var $section \DOMElement */ $ output [ $ type . '-' . $ id . '-section-' . $ s ] = wptexturize ( $ section -> textContent ) ; $ s ++ ; } if ( empty ( $ output ) ) { return false ; } return $ output ; }
Returns an array of subsections in front matter, back matter, or chapters.

@param $id

@return array|false
Returns an array of subsections in front matter back matter or chapters .