Skip to content

Instantly share code, notes, and snippets.

@glideranderson
Created October 28, 2011 16:49
Show Gist options
  • Save glideranderson/1322742 to your computer and use it in GitHub Desktop.
Save glideranderson/1322742 to your computer and use it in GitHub Desktop.
Wordpress loop within template file
<?php
$args = array( 'pagename' => 'contact');
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post();
?>
<h2><?= the_title();?></h2>
<p><?= the_content(); ?></p>
<?php endwhile; ?>
<?php wp_reset_query(); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment