WordPress.org

Make WordPress Core

Opened 8 years ago

Closed 7 years ago

#2200 closed enhancement (invalid)

Ability to hide preview

Reported by: hypercubed Owned by:
Milestone: Priority: low
Severity: normal Version: 2.0
Component: Administration Keywords:
Focuses: Cc:

Description

I really like the new preview feature in v2.0 but I don't always want to use it. Most of the time I don't need to look at it so it is just a waist of bandwidth and server power. I modified the \wp-admin\post.php file to allow me to view the preview only when I need it. It this is worth of inclusion in the trunk please feel free.

in wp-admin/post.php

Replace line 85 with

	<script type="text/javascript">
	<!--
      function show_preview() {
        var elm = document.getElementById("frm_preview");
        elm.src = "<?php the_permalink(); ?>"
        elm.height = "600"
        return false;
      }
	-->
	</script>
	<a href="#preview-post" onclick="show_preview();">Show Preview</a>
		<iframe id="frm_preview" src="" width="100%" height="10" ></iframe>

Attachments (3)

show-hide-preview.diff (1.6 KB) - added by wantmoore 8 years ago.
post.patch (694 bytes) - added by hypercubed 7 years ago.
Patch for verson 2.0.5
post.diff (938 bytes) - added by hypercubed 7 years ago.
Diff for version 2.1

Download all attachments as: .zip

Change History (16)

comment:1 hypercubed8 years ago

  • Keywords 2nd-opinion added

comment:2 davidhouse8 years ago

  • Keywords bg|2nd-opinion bg|has-patch added; 2nd-opinion removed

comment:3 hypercubed8 years ago

I was missing a couple of semicolons in the javascript:

<script type=“text/javascript”>
<!–
  function show_preview() {
    var elm = document.getElementById("frm_preview");
    elm.src = "<?php the_permalink(); ?>";
    elm.height = "600";
    return false;
  }
–>
</script>
<a href=“#preview-post” onclick=“show_preview();”>Show Preview</a>
<iframe id=“frm_preview” src=“” width=“100%” height=“10″ ></iframe>

comment:4 hypercubed8 years ago

Sorry one more time. Some fancy quotes snuck in:

<script type="text/javascript">
<!--
  function show_preview() {
    var elm = document.getElementById("frm_preview");
    elm.src = "<?php the_permalink(); ?>"
    elm.height = "600"
    return false;
  }
-->
</script>
<a href="#preview-post" onclick="show_preview();">Show Preview</a>
<iframe id="frm_preview" src="" width="100%" height="10" ></iframe>

comment:5 skeltoac8 years ago

  • Milestone changed from 2.0 to 2.1

wantmoore8 years ago

comment:6 wantmoore8 years ago

Patch created from $wp_version = '2.0.1'; $wp_db_version = 3437;. Was actually at line 83 of my post.php instead of line 85 as noted by hypercubed.

comment:7 hypercubed8 years ago

WordPress 2.0.1 changed the preview link. The fifth line in my hack should now be:

    elm.src = "<?php echo add_query_arg('preview', 'true', get_permalink($post->ID)); ?>";

comment:8 Nazgul8 years ago

  • Keywords 2nd-opinion has-patch added; bg|2nd-opinion bg|has-patch removed

-1 on this. I use the preview window a lot and I wouldn't like the extra click this imposes on me.

hypercubed7 years ago

Patch for verson 2.0.5

comment:9 matt7 years ago

  • Milestone changed from 2.1 to 2.2

comment:10 markjaquith7 years ago

Not the same fix, but people who want it off altogether can use this:

http://txfx.net/code/wordpress/clutter-free/

comment:11 hypercubed7 years ago

It is now line 72 replaced with:

<script type="text/javascript">
<!--
  function show_preview() {
	var elm = document.getElementById("frm_preview");
	elm.src = "<?php echo attribute_escape(apply_filters('preview_post_link', add_query_arg('preview', 'true', get_permalink($post->ID)))); ?>";
	elm.height = "600";
	return false;
  }
-->
</script>
<a href="#preview-post" onclick="show_preview();">Show Preview</a>
<iframe id="frm_preview" src="" width="100%" height="10" ></iframe>

hypercubed7 years ago

Diff for version 2.1

comment:12 foolswisdom7 years ago

  • Milestone changed from 2.2 to 2.3

comment:13 rob1n7 years ago

  • Keywords 2nd-opinion has-patch removed
  • Milestone 2.3 deleted
  • Resolution set to invalid
  • Status changed from new to closed

Matt just committed changes to make the preview a popup window instead, so this is invalidated.

Note: See TracTickets for help on using tickets.