December 3, 201312 yr I'm trying to make a one page template on wordpress by modyfing twentythirteen, but I noticed that if I don't use the blog index page, I can only put the content of only one page in my index. Is there a way to use wordpress's page codes to show the content of another page? I tried adding again the same codes I used for the first part of the content in that page, but editing them with ids from other pages doesn't seem to do much. Any advice to get around this? Edited December 3, 201312 yr by guru8bit
December 16, 201312 yr First you will want to create a child theme, this way if the theme updates you wont loose your pages. Once you have that all setup you create a new file and call it "page-my-awesome-page.php" In that page you can copy the following to the top <?php /** * Template Name: My Awesome Page */ Now you can create a new page on the right side you should be able to select "My Awesome Page" from the page template list
December 21, 201312 yr So if I understand correctly, you want to make a onepager out of twentythirteen? After you make the page template as above you will want something along the lines of: <section> <?php query_posts('page_id=1'); while ( have_posts() ) : the_post(); ?> <div>?php the_title(); ?></div> <div>?php the_content(); ?></div> <?php endwhile; ?> </section> <section> <?php query_posts('page_id=2'); while ( have_posts() ) : the_post(); ?> <div>?php the_title(); ?></div> <div>?php the_content(); ?></div> <?php endwhile; ?> </section> <section> <?php query_posts('page_id=3'); while ( have_posts() ) : the_post(); ?> <div>?php the_title(); ?></div> <div>?php the_content(); ?></div> <?php endwhile; ?> </section> Of course you would use the correct page id of the pages you want and you could use other information besides the title and the content. You may have to play with this a bit but if you take my example and use query_posts don't forget to add wp_reset_query(); at the bottom of the page.
Create an account or sign in to comment