我正在使用get\\u post\\u类为我的帖子获取类:
post-75 post类型post状态发布格式标准类别未分类条目三分之一摘要优先
但返回的数组不正确:
array (size=9)
0 => string \'post-21\' (length=7)
1 => string \'post\' (length=4)
2 => string \'type-post\' (length=9)
3 => string \'status-publish\' (length=14)
4 => string \'format-standard\' (length=15)
6 => string \'category-uncategorized\' (length=22)
7 => string \'entry\' (length=5)
8 => string \'one-third teaser\' (length=16)
9 => string \'first\' (length=5)
三分之一和Triser应该在单独的插槽中。
这是从Bill Erickson的Genesis网格循环插件生成类的代码:
/**
* Grid Loop Post Classes
*
* @author Bill Erickson
* @link http://www.billerickson.net/a-better-and-easier-grid-loop/
*
* @param array $classes
* @return array $classes
*/
function be_grid_loop_post_classes( $classes ) {
global $wp_query;
$grid_args = $this->be_grid_loop_pagination();
if( ! $grid_args )
return $classes;
// Convert teaser column to a class
$teaser_columns = array( \'\', \'\', \'one-half\', \'one-third\', \'one-fourth\', \'one-fifth\', \'one-sixth\' );
$teaser_column = $teaser_columns[$grid_args[\'teaser_columns\']];
// First Page Classes
if( ! $wp_query->query_vars[\'paged\'] ) {
// Features
if( $wp_query->current_post < $grid_args[\'features_on_front\'] ) {
$classes[] = \'feature\';
// Teasers
} else {
$classes[] = $teaser_column . \' teaser\';
if( 0 == ( $wp_query->current_post - $grid_args[\'features_on_front\'] ) || 0 == ( $wp_query->current_post - $grid_args[\'features_on_front\'] ) % $grid_args[\'teaser_columns\'] )
$classes[] = \'first\';
}
// Inner Pages
} else {
// Features
if( $wp_query->current_post < $grid_args[\'features_inside\'] ) {
$classes[] = \'feature\';
// Teasers
} else {
$classes[] = $teaser_column . \' teaser\';
if( 0 == ( $wp_query->current_post - $grid_args[\'features_inside\'] ) || 0 == ( $wp_query->current_post - $grid_args[\'features_inside\'] ) % $grid_args[\'teaser_columns\'] )
$classes[] = \'first\';
}
}
return $classes;
}