Support » Plugin: TablePress » TablePress Accessibility

  • Resolved lukewarm2019

    (@lukewarm2019)


    I’ve followed instructions in “TablePress ADA accessibility” post. All pages with tables crashed.

    The page I need help with: [log in to see the link]

Viewing 15 replies - 1 through 15 (of 17 total)
  • Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    thanks for your post, and sorry for the trouble.

    Are you referring to https://wordpress.org/support/topic/tablepress-ada-accessibility/ ?
    If so, what exactly did you modify where? And what does “crashed” mean here?

    Regards,
    Tobias

    Yes, that was the post.

    I copied:

    function ada_tablepress_add_summary( $table_attributes, $table, $render_options ) {
    	$table_attributes['summary'] = $table['description'];
    	return $table_attributes;
    }
    add_filter( 'tablepress_table_tag_attributes', 'ada_tablepress_add_summary', 10, 3 );

    and

    function ada_tablepress_add_scope(  $tag_attributes, $table_id, $cell_content, $row_number, $col_number, $colspan, $rowspan ) {
        if ( $row_idx === 1 ) {
            $tag_attributes['scope'] = "col";
            return $tag_attributes;
        }
    }
    add_filter( 'tablepress_cell_tag_attributes', 'ada_tablepress_add_scope', 10, 7 );

    Pages like https://clevelandcc.edu/for-students/student-resources/talent-search/ never loaded.

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    ok, and where did you put this?

    Please try again with the WP_DEBUG constant set to true in your site’s wp-config.php file, see https://codex.wordpress.org/Editing_wp-config.php#Debug
    This should then reveal more error information instead of the blank page.

    Regards,
    Tobias

    Sorry. I placed the code in the “functions.php” file of my theme.

    There is no ‘define( ‘WP_DEBUG’, false );’.

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    putting it in the “functions.php” of your theme is correct, just be sure that it’s before a closing ?> at the end of the file (if that’s there).

    If there is no such line in the wp-config.php, just add

    define( 'WP_DEBUG', true );
    

    somewhere after the line that says to stop editing there.

    Regards,
    Tobias

    OK. Will attempt tomorrow.

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    sounds good! Please let me know if that reveals an error that you can not fix directly.

    Regards,
    Tobias

    I added the code again with the ‘define( 'WP_DEBUG', true );’ statement included.
    All pages that contain TablePress short code don’t even process. No error messages. Get blank, white pages. Don’t even have source code of any kind.

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    that’s really strange then…

    Are you sure that you are copying the exact code from above. What’s really important are that the single and double quotation marks are important.
    Can you maybe post a link to a screenshot of where you added the PHP code?

    Regards,
    Tobias

    Here a screenshot: http://152.27.13.243/functions.php_code.png

    NOTE: your original code was missing an apostrophe.

    function ada_tablepress_add_summary( $table_attributes, $table, $render_options ) {
    	$table_attributes[ summary'] = $table['description'];
    	return $table_attributes;
    }
    add_filter( 'tablepress_table_tag_attributes', 'ada_tablepress_add_summary', 10, 3 );

    $table_attributes[ summary'] = $table['description'];

    I’ve added it in the corrected code.

    • This reply was modified 2 months, 1 week ago by  lukewarm2019.
    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    ah, yes, nice catch! The TablePress code now looks fine to me, and it seems to be in the right place and file.

    However, that

    define( 'WP_DEBUG', true );
    

    line is in the wrong file! This must go into your site’s wp-config.php file, above the line that says to stop editing there!

    Regards,
    Tobias

    The “debug” code is already in the wp-config.php file.
    Still getting blank pages.

    Here’s an error I’m getting from my hosting server log:

    Uncaught TypeError: Argument 1 passed to TablePress_Render::_attributes_array_to_string() must be of the type array, null given, called in /srv/bindings/246c701ad8d54926b82c6cf2e13cc6af/code/wp-content/plugins/tablepress/classes/class-render.php on line 672 and defined in /srv/bindings/246c701ad8d54926b82c6cf2e13cc6af/code/wp-content/plugins/tablepress/classes/class-render.php:733 Stack trace: #0 /srv/bindings/246c701ad8d54926b82c6cf2e13cc6af/code/wp-content/plugins/tablepress/classes/class-render.php(672): TablePress_Render->_attributes_array_to_string(NULL) #1 /srv/bindings/246c701ad8d54926b82c6cf2e13cc6af/code/wp-content/plugins/tablepress/classes/class-render.php(371): TablePress_Render->_render_row(0, 'td') #2 /srv/bindings/246c701ad8d54926b82c6cf2e13cc6af/code/wp-content/plugins/tablepress/classes/class-render.php(135): TablePress_Render->_render_table() #3 /srv/bindings/246c701ad8d54926b82c6cf2e13cc6af/code/wp-content/plugins/tablepress/controllers/controller-frontend.php(645):

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    ah! That helps! 🙂

    Now I see what’s going on. A pretty dumb mistake in my code. The ada_tablepress_add_scope function is not returning anything for rows other than 1. So, please change that function to

    function ada_tablepress_add_scope(  $tag_attributes, $table_id, $cell_content, $row_number, $col_number, $colspan, $rowspan ) {
        if ( $row_idx === 1 ) {
            $tag_attributes['scope'] = "col";
        }
        return $tag_attributes;
    }
    add_filter( 'tablepress_cell_tag_attributes', 'ada_tablepress_add_scope', 10, 7 );

    Regards,
    Tobias

Viewing 15 replies - 1 through 15 (of 17 total)
  • You must be logged in to reply to this topic.