How to include definition lists in the Table of Contents (Elementor) widget

Just add the following code to your theme (or child theme):

				
					/**
 * Table of Contents Widget
 * 
 * Include DL in the list of "Anchors By Tags".
 * 
 * @version 1.0.0
 */
add_action( 'elementor/element/after_section_end', function( $element, $section_id, $args ) {
	if ( 'table-of-contents' == $element->get_name() && 'table_of_contents' == $section_id ) {
		$control = $element->get_controls( 'headings_by_tags' );
		$control['default'][] = 'dt';
		$control['options']['dt'] = 'DT';
		$element->update_control( 'headings_by_tags', $control );
	}
}, 10, 3 );

				
			

Powered by BetterDocs

Newsletter

Subscribe and stay connected through our Newsletter. We send out important news, tips and special offers.

  • This field is for validation purposes and should be left unchanged.