• 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)
  • Plugin Author TC.K

    (@wp_dummy)

    Why you want to use a new query on the conditional check??

    If I not mistaken you want to do the conditional check on each of the searched post, right?
    If so, it should be something like:

    if(in_category( '50943', $post->ID ) ){
    //blah blah blah
    }elsif(in_category( '50944', $post->ID ) ){
    //blah blah blah
    }elseif(in_category( '50945', $post->ID ) ){
    //blah blah blah
    }

    Thread Starter cambridge15

    (@cambridge15)

    I’ll try that right now, thanks TC. K.

    Any place I can donate? You’re really helping me out.

    Plugin Author TC.K

    (@wp_dummy)

    Sure, you can donate at here. Thanks.

    Thread Starter cambridge15

    (@cambridge15)

    Unfortunately I’m getting the same issue, you can recreate it by searching for 2 bedrooms here: https://dev.silvercreativegroup.com/op/availabilities/

    Here’s the setup, the listings are created via an XML feed, the XML feed has two main tags – <Floorplan> & <ILS_Unit>

    The <Floorplan> has an ID that corresponds with an ID in an <ILS_Unit>

    <Floorplan> contains the bedrooms, bathrooms, and featured image.
    <ILS_Unit> contains the apt title, rent, etc.

    That’s why I have to pull that conditional statement into the results because I have two custom post types, one for <Floorplan> and one for <ILS_Unit> acting (for the end user) as one Listing.

    I think what’s happening is my availabilities-block.php is throwing the code in the functions off, closing something (or opening something) prematurely.

    This is my updated availabilities-block.php

    <?php if ( in_category('50943', $post->ID) ) { ?>
    
    				<?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', $post->ID) ) { ?>
    
    				<?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', $post->ID) ) { ?>
    
    				<?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 } ?>

    Any more ideas? Do you offer paid support, if I were to provide FTP details?

    Thanks again for your help, I really appreciate it.

    Plugin Author TC.K

    (@wp_dummy)

    Yes, for hire me to help me you can contact me via here

    Thread Starter cambridge15

    (@cambridge15)

    Ok, message sent successfully! My email is [ email deleted ] – I think I provided the incorrect address on the form.. my apologizes.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Problem with include conditional statement’ is closed to new replies.