Wordpresss is the most popular in the worldBuilding websiteprogram, so manyInternet marketingpractitioners useWordPress websitedoWeb Promotion.
- WordPress Featured Articles are usually only displayed on the homepage, Category Archive pages do not display Featured Articles.
- Websites with more rich content will use pinned articles as recommended articles.
- so that visitors can view recommended content from the site.
If the category list shows all the featured articles on the site, it obviously affects the user experience, so it is more friendly to only show the featured articles in that category.
WordPress category page calls the current category top article method
If you want to call the pinned article of the current category on the category archive page, you can useChen Weiliangmethod shared in this article.

Add the following code to the theme archive.php, or category.php template above the main loop ▼
<?php
query_posts(array(
"category__in" => array(get_query_var("cat")),
"post__in" => get_option("sticky_posts"),
'showposts' => 3,
)
);
while(have_posts()) : the_post();
?>
<h1>置顶<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h1>
<?php
endwhile;
wp_reset_query();
?>among them:'showposts'=> 3, is the displayed quantity.
Exclude pinned articles from the regular article list▼
<?php while(have_posts()) : the_post(); ?>
<?php if(!is_sticky()){?>
<h2><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>
<?php the_excerpt(); ?>
<?php } endwhile;?>If you want to make the WordPress category/tag/author page display the top article, please click to view the following website building tutorial▼
Hope Chen Weiliang Blog ( https://www.chenweiliang.com/ ) shared "How does the WordPress category archive page call the current category sticky article? , to help you.
Welcome to share the link of this article:https://www.chenweiliang.com/cwl-982.html
To unlock more hidden tricks🔑, welcome to join our Telegram channel!
If you like it, please share and like it! Your sharing and likes are our continuous motivation!