WEBSITE TUTORIAL
WordPress display articles by category
By admin | BBBBF News – Breaking World, U.S. & Business Headlines
β’
Published August 28, 2024, 3:26 pm
<?php
$cat_query = new WP_Query(array(
'cat' => '2'
));
?>
<div id="sitebar">
<ul class="nav nav-pills nav-stacked nav-og">
<?php
if ($cat_query->have_posts()) : while ($cat_query->have_posts()) : $cat_query->the_post();
?>
<li><a href=β<?php the_permalink() ?>β target=β_blankβ title=β<?php the_title(); ?>β><?php the_title(); ?></a></li>
<?php endwhile; ?>
<?php endif; ?>
</ul>
</div>