There is a code-example with the output I understand all the entries on the page, and I need to display the records not all, but from a specific category (id=5, name - skills). Please tell me how to do it?
<?php if (have_posts()) { ?><?php $i = 0; ?><?php $per_column = ceil($posts_per_page / 2); ?><?php if ($wp_query->post_count <= $posts_per_page) $per_column = ceil($wp_query->post_count / 2); ?> <?php while (have_posts()) { the_post(); $i++; ?><?php the_title(); ?><?php the_time('d.m.Y') ?><?php the_excerpt(); ?><!-- .post --><?php if ($i == $per_column) { ?><!-- .column --><?php } ?><?php } ?><!-- .column --><?php } ?>
PS Found a solution finally
<?php $args = array('post_type' => 'skills', 'post_status' => 'publish' ); $skills_loop = new WP_Query( $args ); ?> <?php if ($skills_loop->have_posts()) { ?> <?php $i = 0; ?><?php $per_column = ceil($posts_per_page / 2); ?><?php if ($skills_loop->post_count <= $posts_per_page) $per_column = ceil($skills_loop->post_count / 2); ?> <?php while ($skills_loop->have_posts()) { $skills_loop->the_post(); $i++; ?> <?php echo $i; ?><?php the_title(); ?><?php if ($i == $per_column) { ?><!-- .column --><?php } ?><?php } ?><!-- .column --><?php } ?>