How can I make the “Preview Post” button save and preview in the same window?

Here’s a way to do it without modifying the core: add_action(‘admin_footer’,’preview_same_window’); function preview_same_window(){ ?> <script type=”text/javascript”> jQuery(function($){ jQuery(‘.preview.button’).unbind().removeAttr(‘target’); setTimeout(function(){ jQuery(‘.preview.button’).unbind().removeAttr(‘target’); },250); }); </script> <?php }

Disable single pages and archives and keep preview

You can redirect, when someone tries to see the archive or the single of your custom post type, just redirect them to another page, just put this in your functions.php add_action( ‘template_redirect’, ‘theme_redirects’, 99 ); function theme_redirects() { if ( is_post_type_archive( ‘post_type_slug’ ) || is_singular( ‘post_type_slug’ ) ) { wp_redirect( ‘my_url’ ); die(); } } … Read more

How to make scheduled post preview visible to anyone?

Draft previews Take a quick look at this chunk of core code in query.php which [Checks] post status to determine if post should be displayed. http://core.trac.wordpress.org/browser/tags/3.3.1/wp-includes/query.php#L2658 if ( ! is_user_logged_in() ) { // User must be logged in to view unpublished posts. $this->posts = array(); } …is what makes it somewhat non-straightforward to bypass for … Read more

and previews

There’s a bug regarding content pagination links not working when previewing scheduled posts or pages. See ticket #32295 There’s already a proposed patch that adds the missing future status check within the _wp_link_page() helper function, that generates the content pagination links. We could e.g. construct a quick-fix like: add_filter( ‘preview_post_link’, function( $link, $post ) { … Read more