rwparris2
Forum Replies Created
Viewing 1 replies (of 1 total)
-
I needed this too.
Install this as a separate plugin. I made it so that it hides the main content block of a page with the title “Home Page”, but you can change it to whatever title you need. There is a small link to re-enable the main content on the fly if needed.
<?php /* Plugin Name: Hide Main Content Block */ function init_hidemaincontent() { add_meta_box('hide_content',__('Hide Main Content Block','cms'),'add_hidecontent_box','page','normal','high'); } add_action('admin_init','init_hidemaincontent'); function add_hidecontent_box() { global $post; if ( esc_attr( htmlspecialchars( $post->post_title ) ) == 'Home Page') { echo "<style type=\"text/css\">#postdivrich{display:none;}</style>"; echo "<script language=\"javascript\"> function toggle() {"; echo "var ele = document.getElementById(\"postdivrich\"); var text = document.getElementById(\"displayText\");"; echo "if(ele.style.display == \"block\") {ele.style.display = \"none\";text.innerHTML = \"show main content area\";}"; echo "else {ele.style.display = \"block\"; text.innerHTML = \"hide main content area\";}}</script>"; echo '<a id="displayText" href="javascript:toggle();">show main content area</a>'; } }
Viewing 1 replies (of 1 total)