I’m trying to do this loop, but it is going infinite
I just need to show some results on <li>
tags. I’m editing the loop.php
to do this and the function if(function_exists('wp_custom_fields_search')) wp_custom_fields_search();
just return a form of one plugin I had created.
Can you help me with it?
<?php
$queryA = new WP_Query($args1);
$queryB = new WP_Query($args2);
$args1 = array (
'orderby' => 'title',
'order' => 'ASC',
'category_name' => 'lojas',
'posts_per_page' => '-1',
);
$args2 = array (
'orderby' => 'title',
'order' => 'ASC',
'category_name' => 'gastronomia',
'posts_per_page' => '-1',
);
if ($queryA->have_posts()) {
if(function_exists('wp_custom_fields_search')) wp_custom_fields_search();
while($queryA->have_posts()) : $queryA->the_post();
echo '<li>';
echo '<span class="nome">';
the_title();
echo '</span>';
echo '<span class="end">';
echo get('endereco');
echo '</span>';
echo '<span class="tel">';
echo get('telefone');
echo '</span>';
echo '</li>';
endwhile;
}
if ($queryB->have_posts()) {
if(function_exists('wp_custom_fields_search')) wp_custom_fields_search('preset-1');
while($queryB->have_posts()) : $queryB->the_post();
echo '<li>';
echo '<span class="nome">';
the_title();
echo '</span>';
echo '<span class="end">';
echo get('endereco');
echo '</span>';
echo '<span class="tel">';
echo get('telefone');
echo '</span>';
echo '</li>';
endwhile;
}
?>
I must admit from your code I don’t see first-hand what might cause the infinite loop, however you can drastically reduce your code which might help you find your error:
Maybe this helps you to find your error.