loop to grab category only on certain page
-
I have a site with a template that lists property by two types for lease, and for sale. I am creating a loop to grab these by taxonomy for_lease, and for_sale. I’m wondering if I can create an if statement that grabs the category for_sale if page_is for sale page, and grab the category for_lease if the page_is for lease. I’m super new to the wordpress loop and if else statements, so bear with me. Here’s my loop so far which works great for grabbing just one taxonomy and category…I just want to make it a little smarter.
<?php
$args = array(‘post_type’ => ‘property’, ‘proptype’ => ‘for_lease’);
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post(); ?><div>all my stuff that goes in the loop </div>
<?php endwhile; ?> ?
Any help would be much appreciated.
- The topic ‘loop to grab category only on certain page’ is closed to new replies.