Skip to content

Instantly share code, notes, and snippets.

@trevorgreenleaf
Created October 2, 2014 02:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save trevorgreenleaf/43307f89f049d9f66e69 to your computer and use it in GitHub Desktop.
Save trevorgreenleaf/43307f89f049d9f66e69 to your computer and use it in GitHub Desktop.
Products Page
<?php get_header();
/*
Template Name: Product Page
*/
?>
<div class="col-xs-12">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<h1><?php the_title(); ?></h1>
<?php the_content(); ?>
<?php endwhile; endif; ?>
<?php
$args = array(
'post_type' => 'product',
'orderby' => 'title',
'order' => 'ASC'
);
$query_products = new WP_Query( $args ); ?>
<?php if ($query_products->have_posts()) : while ($query_products->have_posts()) : $query_products->the_post(); ?>
<div class="well">
<h1><?php the_title(); ?></h1>
<a href="<?php the_permalink(); ?>" class="btn btn-primary btn-lg">View</a>
</div>
<?php endwhile; endif; ?>
</div>
</div>
</div>
<?php get_footer(); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment