<post id="post-<?php the_ID(); ?>" <?php post_class(); ?> > <?php the_content ;?> </post>
<post id="post-888" class="post-888 post type-post status-publish format-standard hentry category-2 tag-wordpress" > 文章内容 </post>
/**
* Display the classes for the post div.
*
* @since 2.7.0
*
* @param string|array $class One or more classes to add to the class list.
* @param int $post_id An optional post ID.
*/
function post_class( $class = '', $post_id = null ) {
// Separates classes with a single space, collates classes for post DIV
echo 'class="' . join( ' ', get_post_class( $class, $post_id ) ) . '"';
}
<?php get_post_class($class, $post_id); ?>
$MyClass = get_post_class(); var_dump($MyClass);
array(9) {
[0]=>
string(8) "post-249"
[1]=>
string(4) "post"
[2]=>
string(9) "type-post"
[3]=>
string(14) "status-publish"
[4]=>
string(15) "format-standard"
[5]=>
string(6) "hentry"
[6]=>
string(18) "category-catcatcat"
[7]=>
string(8) "tag-tag1"
[8]=>
string(8) "tag-tag2"
}
$MyClass = get_post_class('index-post',249);
//或
$MyClass = get_post_class(array( 'index-post'),249);
var_dump($MyClass);
array(10) {
[0]=>
string(8) "post-249"
[1]=>
string(4) "post"
[2]=>
string(9) "type-post"
[3]=>
string(14) "status-publish"
[4]=>
string(15) "format-standard"
[5]=>
string(6) "hentry"
[6]=>
string(18) "category-catcatcat"
[7]=>
string(8) "tag-tag1"
[8]=>
string(8) "tag-tag2"
[9]=>
string(10) "index-post"
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有