I changed up my theme to work what I think is the "proper" way. After reading in the codex and seeing things on this site.
I started from scratch. loaded the 2012 theme. Made two pages. Home and blog. I set the homepage to have the default 2012 front-page.php template. then in the settings->reading I set static front page to home and posts page to blog. I know the posts will be pulled from the index.php so in that file, I put the custom loop to pull from the blog category and in my front-page.php file I put a custom loop to get pages.
$args = array(
'post_type' => 'page'
);
$page_query = new WP_Query( $args );
if ( $page_query->have_posts() ) : while ( $page_query->have_posts() ) : $page_query->the_post();
$template = get_post_meta( $post->ID, '_wp_page_template', true );
// If the page doesn't have any template assigned - display the default page template
if ( $template == 'default') { ?>
<div class="title"><?php the_title();?></div>
<?php the_content(); ?>
<?php } else {
include( $template );
}
endwhile;
endif;
This loop was working just fine in other versions of this theme but for some reason, set up the way it is now which is suppose to be the right way, it's not working. I also tried using pre_get_posts to display pages on the front-page. ?>
front-page.php
? So you are looping through pages, checking the assigned template, and if that template is not default, you are trying toinclude
the template - is that right? Templates are not intended for inclusion, they represent the overall structure of a page. Also, includingfront-page.php
withinfront-page.php
would lead to infinite inclusions - that is, if you could simplyinclude
a template, which you cannot, as the path to that file is not complete.