Created
January 9, 2019 13:54
-
-
Save rodrigophpweb/2353d485f2d45ebc68a1c34ac0ee4fb9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="response" class="col-lg-9"> | |
<div class="row"> | |
<?php | |
$atuacao = $_GET['atuacao']; | |
$categoria = $_GET['categoria']; | |
// if(is_array($atuacao)){ | |
// exit('é um array'); | |
// } | |
var_dump($atuacao); | |
?> | |
<?php if (is_array($atuacao) and ($categoria)) : ?> | |
<?php | |
$args = array ( | |
'post_type' => 'empresa', | |
'posts_per_page' => 99, | |
'order' => 'DESC' | |
); | |
?> | |
<?php if ( $the_query->have_posts() ) : ?> | |
<?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?> | |
<div class="col-lg-4"> | |
<figure> | |
<a href="<?php the_field('site');?>" target="_blank"> | |
<img src="<?php the_field('marca');?>"> | |
</a> | |
<figcaption><?php the_title();?></figcaption> | |
</figure> | |
</div> | |
<?php endwhile; ?> | |
<?php wp_reset_postdata(); ?> | |
<?php else : ?> | |
<p><?php esc_html_e('Não existe posts nesse momento'); ?></p> | |
<?php endif; ?> | |
<?php else : ?> | |
<?php | |
$meta_query = array('relation' => 'OR'); | |
foreach ($atuacao as $value) { | |
$meta_query[] = array( | |
'key' => 'produtos_e_servicos', | |
'value' => $value, | |
'compare' => 'LIKE' | |
); | |
} | |
foreach ($categoria as $pcat) { | |
$meta_query[] = array( | |
'key' => 'categorias', | |
'value' => $pcat, | |
'compare' => 'LIKE' | |
); | |
} | |
$args = array ( | |
'post_type' => 'empresa', | |
'posts_per_page' => 99, | |
'meta_query' => $meta_query | |
); | |
$the_query = new WP_Query( $args ); | |
?> | |
<?php if ( $the_query->have_posts() ) : ?> | |
<?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?> | |
<div class="col-lg-4"> | |
<figure> | |
<a href="<?php the_field('site');?>" target="_blank"> | |
<img src="<?php the_field('marca');?>"> | |
</a> | |
<figcaption><?php the_title();?></figcaption> | |
</figure> | |
</div> | |
<?php endwhile; ?> | |
<?php wp_reset_postdata(); ?> | |
<?php else : ?> | |
<p><?php esc_html_e( 'Não existe posts nesse momento' ); ?></p> | |
<?php endif; ?> | |
<?php endif;?> | |
</div> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment