Is there a way to make [Table Of Content] plugin while not using revision data?
I have a problem while using TOC plugins 'cause all of TOC plugins use revision data to recognize header tag. I'm using my own metadata (custum field) plugin and the data doens't show on the revision page. It means that the TOC plugins can not recognize my header tag data on the post page. Any great ideas?
This is one of the TOC plugins and you could see the get the revision
public function widget( $args, $instance ) {
global $ht_kb_toc_tools, $wp_query;
if( ! is_singular() )
return;
if ( ! isset( $wp_query ) ) {
return;
}
if( is_a($ht_kb_toc_tools, 'HT_KB_TOC_Tools') ){
if( $ht_kb_toc_tools-ht_block_toc_detected apply_filters('ht_kb_toc_disable_on_ht_block_toc', true ) ){
//early exit if ht-block-toc detected
return;
}
}
extract( $args, EXTR_SKIP );
$instance = wp_parse_args( $instance, $this-defaults );
//$post = get_post( $wp_query-post-ID );
$post = get_post();
if( is_preview() ){
//get the post revisions
$post_revisions = ( wp_get_post_revisions( $post ) );
if ( !empty( $post_revisions ) ) {
//get the latest revision - this should be the current preview
$post = current( $post_revisions );
}
}
$title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this-id_base );
if(is_a($ht_kb_toc_tools, 'HT_KB_TOC_Tools')){
//extract headings
$headings = $ht_kb_toc_tools-ht_kb_toc_extract_headings( do_shortcode( $post-post_content ), true );
//don't output widget if no headings are in content
if(empty($headings))
return;
echo $before_widget;
if ( $title )
echo $before_title . $title . $after_title;
?
nav id=navtoc role=navigation
?php
//display items
$ht_kb_toc_tools-ht_kb_display_items();
?
/nav
?php
}
echo $after_widget;
} // end widget