Support » Fixing WordPress » add class to add_settings_field

  • Using the settings api to build a plugin options page, is it possible to add a css class to the $title in add_settings_field
    <?php add_settings_field( $id, $title, $callback, $page, $section, $args ); ?>
    If $title=”My Text” this outputs html like this
    <table class="form-table"><tr valign="top"><th scope="row">My text</th>

    I would like to be able to add a class to the <th> tag, like so:
    <table class="form-table"><tr valign="top"><th scope="row" class="myclass">My text</th>

    How/can this be done with add_settings_field?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Just to clarify a little further:

    You can add extra user profile fields, for example a Facebook page

    <th><label for="user_facebook" class="facebook">Facebook</label></th>
    <input type="text" name="user_facebook" etc.

    then css could add a Facebook icon tot the <th>

    can this done on an options page with the settings API so as to get the same class (icon)?
    <th scope="row" class="facebook">Facebook</th>

    Funny you should mention this, zyrq, for FF you could try in ‘Your Profile’

    label[for="user_login"]{background-color: #CC0000;}

    doesn’t work for IE though. No label for in the options page though.

    I agree, would be easier to pass a class directly.
    Need to stop talking to myself.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘add class to add_settings_field’ is closed to new replies.