What I want to achieve is a One Page website, with different sections such as slider, skills, about me, contact, portfolio et cetera.
I created different pages, every page is a different section. Every page/section has it's own templatefile.
I also created a page called "One Pager". In this page I want to insert all the other pages. I managed to include just the content of all the sections, but I also want to insert the specific template that comes with it.
I tried:
<?php
$include = get_pages('include=2');
$content = apply_filters('the_content',$include[0]->post_content);
echo $content;
?>
But it just includes the content.
I tried the Wordpress plugin "Insert Pages" which has worked for me in the past, but I can't seem to get it working in my current website. For this plugin I wrote the following code in my page "One Pager":
[insert page='slider' display='page-templates/slider.php']
[insert page='section2' display='page-templates/section2.php']
[insert page='aboutme' display='page-templates/aboutme.php']
But it shows nothing at all.
I'm quite stuck right now. The ideal situation for me would be to insert the template AND the content of specific pages without the use of a plugin. I would love to hear some advice.
EDIT:
I managed to include the template and the content apart from each other.
<?php
get_template_part( 'page-templates/homepage');
$include = get_pages('include=2');
$content = apply_filters('the_content',$include[0]->post_content);
echo $content;
?>
This displays the template homepage.php first, and underneath it it displays the content of the page with id 2 (in my case it refers to Homepage).
But it still doesn't help me. I want to include the page with the template. With the markup, the styling and everything in it.
Okay, I managed it using the "Insert Pages" plugin. My error was within the onepager.php template, the loop wasn't correct.
Unfortunately, I still haven't found an answer to insert the pages with the template, without using the plugin. Advice is still welcome.