php - Page Not Pulling From Correct Category? -
i need page below pull category. i'm not sure how it...in other words when page pulled pull posts 1 category , category only.
not sure add or add it? category "for sale"
http://ampmproperties.com/for-lease-orange-county
<?php /** * template name: sale * * @package wordpress * @subpackage twenty_ten * @since twenty ten 1.0 */ get_header(); ?> <div id="container"> <div class="left_sirebar"> <?php get_sidebar(); ?> </div> <div id="content" role="main"> <?php $args = array( 'posts_per_page' => 3 ); $loop = new wp_query( $args ); while ( $loop->have_posts() ) : $loop->the_post(); if ($count==1) { echo "<tr>"; } echo '<td><div class="for sale">'; echo '<div class="heading_div"><h2 class="entry-title">'; the_title(); echo '</div></h2>'; echo '<div class="entry-content">'; echo '<div class="desc">'; the_excerpt(); echo '</div>'; echo '</div></div></td>'; if($count==$number_of_columns) { echo "</tr>"; $count=0; } $count++; endwhile; ?> </div><!-- #content --> </div><!-- #container -->
you need add category name arguments array:
$args = array('posts_per_page' => 3, 'category_name' => 'for sale');
wordpress' documentation quite - whenever need function wp_query, up. solution right there in documentation: all posts in category.
Comments
Post a Comment