Ticket #2200 (closed enhancement: invalid)
Ability to hide preview
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | low | Milestone: | |
| Component: | Administration | Version: | 2.0 |
| Severity: | normal | Keywords: | |
| 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
Change History
comment:3
hypercubed — 6 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
hypercubed — 6 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>
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
hypercubed — 6 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)); ?>";
- 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.
comment:10
markjaquith — 5 years ago
Not the same fix, but people who want it off altogether can use this:
comment:11
hypercubed — 5 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>
comment:13
rob1n — 5 years ago
- Keywords 2nd-opinion has-patch removed
- Status changed from new to closed
- Resolution set to invalid
- Milestone 2.3 deleted
Matt just committed changes to make the preview a popup window instead, so this is invalidated.

