Skip to content

Instantly share code, notes, and snippets.

@drrobotnik
Created April 4, 2014 01:08
Show Gist options
  • Save drrobotnik/9966070 to your computer and use it in GitHub Desktop.
Save drrobotnik/9966070 to your computer and use it in GitHub Desktop.
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>';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment