Support

Account

Forum Replies Created

  • Thanks so much John! I got everything working right. I really appreciate the help.

  • Thanks John, I got the array working with the query and verified by replacing the variable with set values. It did in fact return the correct salesperson. But now I’m on to my other question which was how to pass the variable from basic select boxes in a form to the query and output the results. Below is the working query.

    <?php
    // WP_Query arguments
    $args = array(
      'post_type' => 'sales_locator',
      'meta_query' => array(
        'relation' => 'AND',
        array(
          'key' => 'sl_country',
          'value' => '"'.$country.'"',
          'compare' => 'LIKE'
        ),
        array(
          'key' => 'sl_state',
          'value' => '"'.$state.'"',
          'compare' => 'LIKE'
        ),
        array(
          'key' => 'sl_industry',
          'value' => '"'.$industry.'"',
          'compare' => 'LIKE'
        )
      )
    );
    
    // query
    $the_query = new WP_Query( $args );
    
    ?>
    <?php if( $the_query->have_posts() ): ?>
    	<ul>
    	<?php while( $the_query->have_posts() ) : $the_query->the_post(); ?>
    		<li>
    			<h1><?php the_field('sl_name'); ?></h1>
    			<?php the_content(); ?>
    		</li>
    	<?php endwhile; ?>
    	</ul>
    <?php endif; ?>
    
    <?php wp_reset_query();	 // Restore global post data stomped by the_post(). ?>
    
  • I’m storing the salesperson name as a text field and all other information as setup as checkboxes on the back end. I’m really new to this plugin and I’m struggling with getting this to work

Viewing 3 posts - 1 through 3 (of 3 total)