Problem with include conditional statement
-
You’re a great plugin author, thanks for the support. Can we donate somewhere?
I have a new issue, I have a conditional statement setup for if the listing is within a certain category, if it is it’s supposed to display the bedrooms, bathrooms, and square footage of that category but it seems broken when preforming the UWQSF search.
https://dev.silvercreativegroup.com/op/availabilities/
^ try searching for 2 bedrooms.Here is my functions code,
if ( $query->have_posts() ) { while ( $query->have_posts() ) { $query->the_post(); global $post; $query->the_post(); echo '<a href="'.get_permalink().'"><li class="availabilities-result">'; echo '<div class="availabilities-result-title">'; echo the_title(); echo '</div>'; echo '<div class="availabilities-result-image-hover">'; echo 'View Listing'; echo '</div>'; echo '<div class="availabilities-result-image">'; echo get_the_post_thumbnail(); echo '</div>'; echo '<div class="availabilities-result-rent">'; echo the_field('rent'); echo '</div>'; echo '<div class="availabilities-result-avail">'; if( get_field('available_date') ) { echo get_field('available_date'); } else { echo date('m/d'); } echo '</div>'; echo include('conditions/availabilities-block.php'); echo '</li></a>'; }
And this is availabilities-block.php,
<?php if ( in_category('50943') ) { ?> <?php $query = new WP_Query('post_type=floorplans&p=308'); while ( $query->have_posts() ) : $query->the_post(); ?> <div class="availabilities-result-bedrooms"><?php the_field('bedrooms'); ?></div> <div class="availabilities-result-bathrooms"><?php the_field('bathrooms'); ?></div> <div class="availabilities-result-sqft"><?php the_field('sqft'); ?></div> <?php endwhile; ?> <?php } elseif ( in_category('50944') ) { ?> <?php $query = new WP_Query('post_type=floorplans&p=309'); while ( $query->have_posts() ) : $query->the_post(); ?> <div class="availabilities-result-bedrooms"><?php the_field('bedrooms'); ?></div> <div class="availabilities-result-bathrooms"><?php the_field('bathrooms'); ?></div> <div class="availabilities-result-sqft"><?php the_field('sqft'); ?></div> <?php endwhile; ?> <?php } elseif ( in_category('50945') ) { ?> <?php $query = new WP_Query('post_type=floorplans&p=310'); while ( $query->have_posts() ) : $query->the_post(); ?> <div class="availabilities-result-bedrooms"><?php the_field('bedrooms'); ?></div> <div class="availabilities-result-bathrooms"><?php the_field('bathrooms'); ?></div> <div class="availabilities-result-sqft"><?php the_field('sqft'); ?></div> <?php endwhile; ?> <?php } else { ?> <?php } ?>
https://www.ads-software.com/plugins/ultimate-wp-query-search-filter/
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘Problem with include conditional statement’ is closed to new replies.