WordPress模板标签sticky_class用于在The Loop主循环中,如果文章为置顶状态时,则输出类名:sticky,以便于为置顶文章设置特殊样式。
sticky_class( int $post_id = null )
函数参数
$post_id
整数型,默认值:null
指定文章ID,在The Loop主循环中不需要指定。
函数使用示例
在归档页面循环输出文章,置顶文章的容器会加上sticky类。
<div 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