WordPress.org

Ready to get started?Download WordPress

Forums

add class to add_settings_field (3 posts)

  1. zyrq
    Member
    Posted 3 years ago #

    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?

  2. zyrq
    Member
    Posted 2 years ago #

    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>

  3. zyrq
    Member
    Posted 2 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic