David Biga
David Biga

Reputation: 2801

issue with post format in wordpress on a custom page template

Hey guys so I am trying to have a loop run to get all the post that are within a certain category on a page, for some reason nothing happens though?

Code :

<?php
/*
Template Name: djequip
*/

get_header(); ?>

        <div id="primary">

            <div id="content" role="main">

                <?php /*query_posts('test');uncategorized*/
                if ( have_posts() ) : while ( have_posts() ) : the_post(); 
                 get_template_part( 'content', get_post_format() ); 
                endwhile; endif; ?>

            </div><!-- #content -->
        </div><!-- #primary -->

<?php get_sidebar(); ?>
<?php get_footer(); ?>

Let me know if you can help, thanks a ton!

Upvotes: 1

Views: 109

Answers (1)

Laura Clarke
Laura Clarke

Reputation: 131

<?php /* Template Name: TEMPLATE NAME */ ?>
<?php get_header();?>

<?php query_posts('category_name=CATEGORY NAME'); ?>
   <?php while (have_posts()) : the_post(); ?>
      <?php the_excerpt(); ?>
<?php endwhile; ?>

Is this what you mean?

the_excerpt

can be changed to

the_content

Also I'd just like to add that you can put divs in there around the WP PHP.

Upvotes: 2

Related Questions