Hi,
thanks for your post, and sorry for the trouble.
The best approach should be by using filter hooks. For some ideas on this, please see https://ww.wp.xz.cn/support/topic/accessibility-attribute-for-tablepress/ and https://ww.wp.xz.cn/support/topic/tablepress-accessibility/
Regards,
Tobias
Hello,
I read through both of those posts and inputted the following code. However, I’m still not seeing the scope attribute added to the table.
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 );
Hi,
where did you add that code? Your theme’s “functions.php”?
Can you maybe save the table again (after a dummy change), to clear the cache?
Regards,
Tobias
I added it within my theme’s functions.php. I just tried making a dummy change and saving the table, and I cleared the website’s cache and my browser’s cache.
Hi,
ah, I just spotted a small mistake in that code. Can you please try again with
function ada_tablepress_add_scope( $tag_attributes, $table_id, $cell_content, $row_number, $col_number, $colspan, $rowspan ) {
if ( $row_number === 1 ) {
$tag_attributes['scope'] = "col";
}
return $tag_attributes;
}
add_filter( 'tablepress_cell_tag_attributes', 'ada_tablepress_add_scope', 10, 7 );
Regards,
Tobias
Oh, perfect! That did the trick!
Thanks so much,
Jenna
Hi,
no problem, you are very welcome! 🙂 Good to hear that this helped!
Best wishes,
Tobias
P.S.: In case you haven’t, please rate TablePress here in the plugin directory. Thanks!