Wordpress 如何将自定义类添加到<;文章>;成因框架

Wordpress 如何将自定义类添加到<;文章>;成因框架,wordpress,genesis,Wordpress,Genesis,我试图在genesis子主题中添加引导的列类。我不知道如何将这些类添加到HTML的目录中 在花了更多的时间后,我终于明白了 在函数中添加 //* Add custom classes to posts add_filter( 'genesis_attr_entry', 'atp_post_class' ); function atp_post_class( $attributes ) { $attributes['class'] = 'col-md-4 ' . join( ' ', g

我试图在genesis子主题中添加引导的列类。我不知道如何将这些类添加到HTML的目录中

在花了更多的时间后,我终于明白了

在函数中添加

//* Add custom classes to posts
add_filter( 'genesis_attr_entry', 'atp_post_class' );
function atp_post_class( $attributes ) {

    $attributes['class'] = 'col-md-4 ' . join( ' ', get_post_class() );

    if ( ! is_main_query() && ! genesis_is_blog_template() ) {
        return $attributes;
    }

    $attributes['itemscope'] = true;
    $attributes['itemtype']  = 'http://schema.org/CreativeWork';

    return $attributes;
}

$attributes['class']
已包含类字符串,因此您可以将属性行更改为:
$attributes['class']。='col-md-4'