The easiest way to solve this is to create a special template file for previews, that will show the post twice in the different layouts.
The following code will use the single-preview.php
template file if it exists:
add_filter( 'single_template', 'wpse15770_single_template' );
function wpse15770_single_template( $templates )
{
if ( is_preview() ) {
$templates = locate_template( array( 'single-preview.php', $templates ) );
}
return $templates;
}
If you want to show the same post twice you must remember to add rewind_posts()
in your single-preview.php
template file, otherwise you can’t loop over the posts again.
Related Posts:
- Post/Page Preview Template
- Display page content AFTER a loop of posts
- Using custom post template
- custom post template file not shown, instead all the time 404.php
- Tell WP to use a specific template file in posts
- Create a custom posts page
- add_rewrite_rule and template redirect not working
- Custom post type template not called
- single- and archive- templates not being applied to custom post types, not even after flushing permalinks
- Adding The Post Template Dropdown to WP-Admin
- custom post type single page template not working
- Custom Post Types, slug, archive and SEO plugins
- Search Custom Post Type Pages and Custom Fields in 2 Dropdowns?
- Using single.php from plugin folder instead of default template folder
- How to get Images included in Post
- How to disable drafts?
- how to enable different number of revisions for different blogs when using WPMU?
- Custom Post Type Pagination Doesn’t Work in WordPress 3.4
- Unattaching images from a post
- Post from front-end only by logged in users, form posts as “posted by:
- Allow role to delete posts but block him the wp-admin
- Why does `url_to_postid` return 0 when testing `page_for_posts` Page?
- How only display all post related to category
- Using Custom Posts with Metaboxes and Drop-downs
- ‘Invalid post type’ error when importing from one site to another
- Blogroll – Different layout for first post
- How to delete old posts’ edits to save space?
- Archive Page for Custom Post Type is not Working
- Filter Custom Post Type by Category with Ajax
- How to make number of blog posts a custom field?
- WordPress blog or WordPress website
- Hiding Draft Post In Admin
- Show posts by a custom post author
- Search results posts_orderby and ID
- Making a custom Pagination for multi page blog post
- Unable to restore from backup – how to obtain old blog posts?
- Custom Post Type Rewrite To Include Parent Page(s)
- Thumbnail & Category link aside post
- How to create a template for Pages?
- Custom taxonomy archive page problem
- Is there a way to create a meta box that can be added multiple times to a post dynamically?
- Custom Post Type archive
- WordPress custom post type with folder structure in slug
- How to identify and hide/remove an element from a WordPress page [closed]
- wordpress posts template remove default template from menu
- How to add automatically bootstrap 4 order-lg-1 and order-lg-2 classes for columns in foreach loop based on the count?
- How to add convenient buttons for new custom post statuses
- Show custom post with custom categories with specific slug
- Auto delete posts based on content text
- How to call posts under a specific category on static front page?
- Give posts a particular template based on the assigned category
- Display value of custom field at the beginning of a post
- Optimize CPT-function with a loop
- Add post tags to previously created custom post type
- How to display only one category in a custom post type?
- Changing permalink of WordPress
- Hook save_post_cpt not triggered when custom fields are modified
- Turn off display for custom sidebar post widget when on the post it’s displaying
- How to allow WordPress to recognize a custom URL segment after a product URL and use a custom template?
- How to bulk Update URLs to new values?
- Include Recent Post in Category
- Pagination Not Working With Custom Post Type Category
- WordPress Pods Custom Post Type – separate Media Upload folder for each custom Post Types
- Hide or remove custom post status
- Put page on Archived statut after end of publication date
- post and page and custom post type
- My posts page is missing the page title
- Show custom post category for single post
- How can change header text in post careate/edit form
- How to get meta data from custom category name
- Add Categories To Custom Post
- Is it possible to query a category with specified posts?
- How do I set content in my pages so that it remains permanent while blog posts are added below?
- how to redirect page after delete post inside a post page?
- Permalink base only for posts
- Difference between modified post and new post
- Creating widget – ask for selecting a post in the admin panel
- issue in wordpress auto delete post and redirect to another 1
- wp query custom orderby not custom field
- Customizing individual images on posts
- Custom Single Post Type not referring to single-post-type.php File
- My blog “page” used to show a list of posts, but now it’s just showing the page content?
- Custom template for different post types
- How to modify specific parts of a post content in WordPress
- Include post on external custom site
- Run Jquery Script after delete post in front end
- Posts page template: How can I edit the markup for this?
- “Current” class on a singular page menu item with custom post types?
- Successive creation of over 1000 posts causes 404?
- Which hooks are essential for post templates?
- How can I allow users (subscribers) to download selected posts into a single PDF? (RESOLVED)
- Choose options via url
- Custom Post Type Pagination 404 Error (if paged>=2) [duplicate]
- Display ONLY Latest Post From Several Categories
- Display post structure in function
- Default post type doesn’t display in url
- Is there a block to print post link standalone in a block theme?
- Dynamic Menu Item
- Changes done in admin panel are taking time to reflect in the REST api responses
- I have a website issue I am trying to resolve