У меня есть два запроса в Wordpress и мне интересно, есть ли способ объединить их в один? Я пробовал еще, если, но безрезультатно.Объединение нескольких, если в одном?
<?php
$posts = get_field('appeal_forms', 'options');
if($posts): ?>
<ul>
<?php foreach($posts as $post): // variable must be called $post (IMPORTANT) ?>
<?php setup_postdata($post); ?>
<li>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
</li>
<?php endforeach; ?>
</ul>
<?php wp_reset_postdata(); // IMPORTANT - reset the $post object so the rest of the page works correctly ?>
<?php endif; ?>
А вот второй:
<?php
$posts = get_field('misc', 'options');
if($posts): ?>
<ul>
<?php foreach($posts as $post): // variable must be called $post (IMPORTANT) ?>
<?php setup_postdata($post); ?>
<li>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
</li>
<?php endforeach; ?>
</ul>
<?php wp_reset_postdata(); // IMPORTANT - reset the $post object so the rest of the page works correctly ?>
<?php endif; ?>
вам не хватает некоторых из кода? – RobP
Итак, какие 2 вопроса вы хотите объединить? – JiFus
Извинения, исправлено – Deedub