drrobotnik
4/4/2014 - 1:08 AM

Theme Docs

Theme Docs

add_action('save_post', 'cv_on_post_update_flush_transient');

add_action('admin_menu', 'cv_docs_menu');

function cv_docs_menu() {
	$page = get_stylesheet_directory() . '/doc/index.html';
	if( file_exists( $page ) ){
		add_menu_page('Theme Documentatio', 'Theme Docs', 'edit_posts', 'cv_docs', 'cv_docs_page', 'dashicons-format-aside', 200);
	}
}

function cv_docs_page(){

	$page = get_stylesheet_directory() . '/doc/index.html';
	if( file_exists( $page ) ){
	echo '<iframe id="cv_docs" src="'.get_stylesheet_directory_uri() . '/doc/index.html" width="100%" height="100%"></iframe>';
	echo '<script type="text/javascript">
	jQuery( document ).ready(function($) {
    console.log( "ready!" );
    $("#cv_docs").height( $(window).innerHeight() - 40 );
    $(window).on("resize",function(){
			$("#cv_docs").height( $(window).innerHeight() - 40 );
    });
});
</script>
<style>
#wpfooter{display:none;}
#wpbody-content {padding-bottom: 0;}
</style>';
	}
}