base, array( 'post', 'page' ), true ) ) return;
global $post;
if ( ! $post ) return;
preg_match_all( '/]+>/i', $post->post_content, $images );
$missing = 0;
foreach ( $images[0] as $img ) {
if ( ! preg_match( '/alt=["\'][^"\']+["\']/i', $img ) ) {
$missing++;
}
}
if ( $missing > 0 ) {
printf(
'
%s
' . esc_html__( 'No headings found in this content.', 'a11ykit-accessibility' ) . '
'; return; } $issues = array(); $prev = 0; foreach ( $headings[1] as $i => $level ) { $level = (int) $level; if ( $prev && $level > $prev + 1 ) { $issues[] = sprintf( // esc_html__( 'Heading level jumped from H%d to H%d (skipped levels).', 'a11ykit-accessibility' ), /* translators: 1: previous heading level, 2: current heading level */ esc_html__( 'Heading level jumped from H%1$d to H%2$d (skipped levels).', 'a11ykit-accessibility' ), $prev, $level ); } $prev = $level; } if ( empty( $issues ) ) { echo '✓ ' . esc_html__( 'Heading structure looks good!', 'a11ykit-accessibility' ) . '
'; } else { echo '' . esc_html__( 'Headings found:', 'a11ykit-accessibility' ) . '