• Hi,

    the img html element of attachment file’s pdf for example

    <img src="/wp-content/plugins/custom-post-type-pdf-attachment/images/pdf.png" style="z-index: 2147483646; position: relative;">

    not contain “alt” attribute, requested by WCAG 2.0

    I not be able to override your the shortcode , I developed this :

    function custom_pdf_attachment_shortcode_child_theme( $atts ) {
             global $post;
             extract( shortcode_atts( array(
                  'file' => '',
                  'name' => ''
             ), $atts ) );
    
             if(!$file){
                return;
             }
    
             if(!cpta_get_file_url($post->ID,$file)){
                return;
             }
    
             $pdf_open_in = get_option('pdf_open_in');
             $target = ( $pdf_open_in == '' ? '_self' : $pdf_open_in ); 
    
             if($name){
                $ret = '<img src="'.plugins_url( CPTA_PLUGIN_DIR . '/images/pdf.png' ).'"  alt="Download PDF '.$name.'" > <a href="'.cpta_get_file_url($post->ID,$file).'" target="'.$target.'">'.$name.'</a>';
            } else {
                $file_mime_data = wp_check_filetype(cpta_get_file_url($post->ID,$file));
                $file_info = pathinfo(cpta_get_file_url($post->ID,$file));
                $ret = '<img src="'.plugins_url( CPTA_PLUGIN_DIR . '/images/pdf.png' ).'"  alt="Download PDF '.$file_info['basename'].'" > <a href="'.cpta_get_file_url($post->ID,$file).'" target="'.$target.'">'.$file_info['basename'].'</a>';
            }
             return $ret;
    }

    I think good is a good feature more, is it possible to add that ?
    Thank you.
    Beste regards.

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

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)

The topic ‘Web Content Accessibility Guidelines Complience’ is closed to new replies.