TablePress Accessibility
-
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]
-
Hi,
thanks for your post, and sorry for the trouble.
Are you referring to https://www.ads-software.com/support/topic/tablepress-ada-accessibility/ ?
If so, what exactly did you modify where? And what does “crashed” mean here?Regards,
TobiasYes, 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.
Hi,
ok, and where did you put this?
Please try again with the
WP_DEBUG
constant set totrue
in your site’s wp-config.php file, see https://codex.www.ads-software.com/Editing_wp-config.php#Debug
This should then reveal more error information instead of the blank page.Regards,
TobiasSorry. I placed the code in the “functions.php” file of my theme.
There is no ‘define( ‘WP_DEBUG’, false );’.
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,
TobiasOK. Will attempt tomorrow.
Hi,
sounds good! Please let me know if that reveals an error that you can not fix directly.
Regards,
TobiasI 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.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,
TobiasHere a screenshot: https://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 6 years, 1 month ago by
lukewarm2019.
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,
TobiasThe “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):
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 tofunction 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 -
This reply was modified 6 years, 1 month ago by
- The topic ‘TablePress Accessibility’ is closed to new replies.