如何在以下PHP代码中添加额外的类?

时间:2014-01-07 09:05:52

标签: php wordpress

enter image description here

那是我的wordpress插件代码

$html .= $userMeta->createInput( 'remember', 'checkbox', array(
    'value'         => isset( $_REQUEST['remember'] ) ? true : false,
    'label'         => !empty( $config['remember_label'] ) ?  $config['remember_label']   : __( 'Remember Me', $userMeta->name ),
    'id'            => !empty( $config['remember_id'] ) ? $config['remember_id'] :    'remember' . $uniqueID,
    'class'         => !empty( $config['remember_class'] ) ? $config['remember_class'] : 'um_remember_field',
    'enclose'       => 'p',
) );    

我想在<p>标签上添加一个类,以提供额外的样式,特别是显示无。 `

1 个答案:

答案 0 :(得分:3)

试试这个:

$html .= $userMeta->createInput( 'remember', 'checkbox', array(
    'value'         => isset( $_REQUEST['remember'] ) ? true : false,
    'label'         => !empty( $config['remember_label'] ) ?  $config['remember_label']   : __( 'Remember Me', $userMeta->name ),
    'id'            => !empty( $config['remember_id'] ) ? $config['remember_id'] :    'remember' . $uniqueID,
    'class'         => !empty( $config['remember_class'] ) ? $config['remember_class'] : 'um_remember_field',
    'enclose'       => 'p class="myclass"',
) );