Я пытаюсь отображать свои категории и сообщения в этой категории в 2 столбцах.Wordpress Category List 2 Columns
Я попытался решить проблему с помощью CSS, но это не получилось очень хорошо.
Вот мой код:
<?php
$cat_id = get_query_var('cat');
$catlist = get_categories('hide_empty=0&child_of=' . $cat_id);
foreach($catlist as $categories_item) {
echo "<div class='half'>";
$cat_title = get_field('category_title' , 'category_' . $categories_item->term_id);
echo "<ol>";
echo '<h3><a href="' . get_category_link($categories_item->term_id) . '" ' . '>' . $cat_title .'</a> </h3> ';
query_posts(array(
'cat' => $categories_item->term_id,
'posts_per_page' => 9999,
'order' => 'ASC', //order ascending
'orderby' => 'title' //order by title
));
if (have_posts()) : while (have_posts()) : the_post(); ?>
<li><a href="<?php the_permalink();?>">
<?php the_title(); ?>
</a></li>
<?php endwhile; endif; ?>
<?php echo "</ol>"; echo "</div>"; ?>
<?php } ?>
Любые идеи?
Заранее благодарен! :)