Skip to content

Instantly share code, notes, and snippets.

@spigotdesign
Created August 30, 2022 20:47
Show Gist options
  • Save spigotdesign/590952ed3b6cdcb0c500217b686261da to your computer and use it in GitHub Desktop.
Save spigotdesign/590952ed3b6cdcb0c500217b686261da to your computer and use it in GitHub Desktop.
$args = [
'post_type' => 'ht_kb',
'tax_query' => [
[
'taxonomy' => 'ht_kb_category',
'terms' => $hkb_current_term_id,
],
],
'posts_per_page' => 5,
'orderby' => 'term_id',
'order' => 'ASC',
]; ?>
<?php $article_list = new WP_Query( $args ); ?>
<ul class="hkb-article-list">
<?php if ( $article_list->have_posts() ) { ?>
<?php while ( $article_list->have_posts() ) { ?>
<?php $article_list->the_post(); ?>
<li class="hkb-article-list__item">
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
</li>
<?php } ?>
<?php } ?>
<?php wp_reset_postdata();?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment