WordPress置顶文章类名标签:sticky_class

WordPress模板标签sticky_class用于在The Loop主循环中,如果文章为置顶状态时,则输出类名:sticky,以便于为置顶文章设置特殊样式。

sticky_class( int $post_id = null )

函数参数

$post_id

整数型,默认值:null

指定文章ID,在The Loop主循环中不需要指定。

函数使用示例

在归档页面循环输出文章,置顶文章的容器会加上sticky类。


	<div class="">
		......
	

扩展阅读

sticky_class()函数位于:wp-includes/general-template.php

相关函数:

原创文章,作者:,如若转载,请注明出处:https://ce.771633.xyz/1539.html

Like (0)
Previous 2025年3月8日
Next 2025年3月8日

相关推荐

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注