• Some of the WordPress functions output HTML table tags which I would like to replace with unordered list tags. I’m wondering if there are any issues, other then updates and changes to the core, that I need to be worried about. For example I copied a function to my function file, change the name and changed the table tags to ordered list tags. I changed the call to my new function and it runs fine without any errors. Any thoughst would be appreciated.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator Samuel Wood (Otto)

    (@otto42)

    www.remarpro.com Admin

    It’s hard to say without more details. Which functions are you referring to?

    Thread Starter tsalagi

    (@tsalagi)

    Thanks Otto. Here are the functions

    function do_settings_sections($page) {
        global $wp_settings_sections, $wp_settings_fields;
    
        if ( !isset($wp_settings_sections) || !isset($wp_settings_sections[$page]) )
            return;
    
        foreach ( (array) $wp_settings_sections[$page] as $section ) {
            echo "<h3>{$section['title']}</h3>\n";
            call_user_func($section['callback'], $section);
            if ( !isset($wp_settings_fields) || !isset($wp_settings_fields[$page]) || !isset($wp_settings_fields[$page][$section['id']]) )
                continue;
            echo '<table class="form-table">';
            do_settings_fields($page, $section['id']);
            echo '</table>';
        }
    }

    and

    function do_settings_fields($page, $section) {
        global $wp_settings_fields;
    
        if ( !isset($wp_settings_fields) || !isset($wp_settings_fields[$page]) || !isset($wp_settings_fields[$page][$section]) )
            return;
    
        foreach ( (array) $wp_settings_fields[$page][$section] as $field ) {
            echo '<tr valign="top">';
            if ( !empty($field['args']['label_for']) )
                echo '<th scope="row"><label for="' . $field['args']['label_for'] . '">' . $field['title'] . '</label></th>';
            else
                echo '<th scope="row">' . $field['title'] . '</th>';
            echo '<td>';
            call_user_func($field['callback'], $field['args']);
            echo '</td>';
            echo '</tr>';
        }
    }

    Moderator Samuel Wood (Otto)

    (@otto42)

    www.remarpro.com Admin

    Editing those parts of the core might be a *really* bad idea. Those are core parts of the Settings API, and plugins use them and expect them to behave in a certain way. Changing those will very likely affect how plugins settings screens work.

    If you want to use a different method for displaying options in your own plugin or theme or something, you don’t really need to copy those functions to different names. Just make your plugin screen the way you want to make it instead of using those parts of the Settings API.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Replace WordPress HTML output with New function’ is closed to new replies.