In this article, we will show you how to insert content from one WordPress page to another post, page, or any custom post types.

First thing you need to do is install and activate the Insert Pages plugin. Upon activation simply go to Posts » Add New to see it in action.

If you use visual editor, then you will notice a new button labeled ‘Insert Page’ in the menu.

Insert page button in the visual editor

Clicking on it will bring up a popup where you can select the page, post, or custom post type you want to add.

Insert page popup

You can choose how you would like to insert the post/page by clicking on the Options. By default you can add title, content, link, or choose a custom template. We will explain custom templates later in this article.

After choosing the post/page click on the Insert Page button. The plugin will add the shortcode required to display your selected post/page.

If you use the text editor to write your posts, then you can manually enter the shortcode. The shortcode parameters are quite simple.

[insert page='page-slug|ID' display='title|link|content|all|custom-template.php']

The page parameter for the shortcode accepts page-slug or ID. Please note that by page slug, it doesn’t mean that you can only enter pages. You can add any post or custom post type’s slug as well.

You can also use post id. Here is a quick guide on how to find post id in WordPress.


[insert page='author-syed-balkhi' display='content']
[insert page='128' display='content']
[insert page='128' display='all']
[insert page='128' display='custom-author.php']

Adding Custom Post Types into Posts

Using WordPress you can add any type of content by creating post types for different content types. Checkout our guides on when do you need a custom post type and how to create a custom post type in WordPress.

Insert Pages allows you to add your custom post types into posts and pages. For example, you can create a custom post type for image galleries and then use Insert Pages to add those galleries into your posts or pages.

A custom gallery post type added into a WordPress post

Similarly, you can create custom post types for videos, portfolio, client testimonials, etc. to add into your pages or posts.

Using Custom Templates to Display Inserted Pages

Insert Pages allows you to display title, link, content, or all fields for inserted pages. However some users may still need to tweak the display to meet their own needs. This can be achieved by using custom templates.

All you need to do is create a blank php file and upload it to your theme directory. You can name the file anything you want. For example, custom-author.php.

This custom template works exactly like any other content template files in your theme. Here is sample template file that we created to display author pages.

 

You can use custom CSS classes in your template file and then style them in your theme’s stylesheet. We used this to style the display of author pages.

h3.author-name { 
font-size:16px;
}
.author-thumbnail { 
float:left;
padding:10px;
} 
.author-bio { 
font-style:italic; 
font-family: Lora, Georgia, Serif;
} 

This is how the end result looked on our dummy site:

Author bio page inserted into a WordPress post

We hope this article helped you add content from one WordPress page/post to another.

source: wpbeginner.com