I'm building an one page WordPress theme. I have created a template with following code:
<?php get_header();?> <?php $args = array( 'post_type' => 'page' ); $the_query = new WP_Query($args); ?> <?php if( have_posts() ) : while( $the_query->have_posts() ) : $the_query->the_post(); ?> <?php global $post; ?> <article id="<?php echo $post->post_name; ?>" <?php post_class(); ?>> <?php the_content(); ?> </article><!-- #post-## --> <?php endwhile; endif; ?> <?php get_footer();?>
Now, everything is actually working fine. However, if I assign another template to one of the pages, nothings is shown. Or in other words, I would like to show information from a template on a certain page, but noting is shown, only if I add some code/text to the content area on the actual page.
Since I couldn't get it to work, I went back to show following code on the homepage.php template with no additional loop (nothing is shown on the website):
<header> <div class="container"> <div class="row"> <div class="col-lg-12"> <img class="img-responsive" src="<?php the_field( 'profile_picture' ); ?>" alt=""> <div class="intro-text"> <span class="name"><?php the_field('name');?></span> <hr class="star-light"> <span class="skills"><?php the_field( 'job_title_1' );?> - <?php the_field( 'job_title_2' );?> - <?php the_field( 'job_title_3' );?></span> </div> </div> </div> </div> </header>
This might have to do with a double loop, however, I can't seem to get it to work.
Thanks a lot!