1 / 22

Accessible WordPress Theme Development

Accessible WordPress Theme Development. AccessU 2011 Pat Ramsey slash25 code pat@slash25.com. Is WordPress Accessible?. Front-end: Controlled by your theme. Is as accessible as you make it. Back-end: Controlled by WordPress core-developers, contributors, and you.

alvis
Download Presentation

Accessible WordPress Theme Development

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Accessible WordPress Theme Development • AccessU 2011 • Pat Ramsey • slash25 code • pat@slash25.com

  2. Accessible WordPress Theming - Pat Ramsey Is WordPress Accessible? • Front-end: • Controlled by your theme. • Is as accessible as you make it. • Back-end: • Controlled by WordPress core-developers, contributors, and you. • Can be customized by you via your theme's functions.php.

  3. Accessible WordPress Theming - Pat Ramsey Front-end accessibility • Know where you want to be • TwentyTen (soon to be TwentyEleven) • Developing a Child Theme: • Must check the parent theme's accessibility, too.

  4. Accessible WordPress Theming - Pat Ramsey Back-end accessibility • Room for improvement. • Greater difficulty, but can be done • Avoid modifying core files (files outside your theme)

  5. Accessible WordPress Theming - Pat Ramsey WordPress is listening • http://make.wordpress.org/accessibility/ • You can contribute…

  6. Accessible WordPress Theming - Pat Ramsey Ready to go?Improving the theme • Improve the WordPress search form • Links • Comment Form • Read More links – excerpts • Internationalization

  7. Accessible WordPress Theming - Pat Ramsey Improving the Back End • Add a Skipnav to skip the administrative menu • Improve the CSS for link focus & outline

  8. Accessible WordPress Theming - Pat Ramsey WordPress' Search Form • <form method="get" id="searchform" action="<?php echo home_url( '/' ); ?>"> • <input type="text" class="field" name="s" id="s" placeholder="<?php esc_attr_e( 'Search', 'twentyeleven' ); ?>" /> • <input type="submit" class="submit" name="submit" id="searchsubmit" value="<?php esc_attr_e( 'Search', 'twentyeleven' ); ?>" /> • </form>

  9. Accessible WordPress Theming - Pat Ramsey More accessible search form • <form method="get" id="searchform" action="<?php echo home_url( '/' ); ?>"> • <label for="s"><?php _e("Search the site");?></label> • <input type="text" class="field" name="s" id="s" placeholder="<?php esc_attr_e( 'Search', 'twentyeleven' ); ?>" /> • <input type="submit" class="submit" name="submit" id="searchsubmit" value="<?php esc_attr_e( 'Search', 'twentyeleven' ); ?>" /> • </form>

  10. Accessible WordPress Theming - Pat Ramsey More accessible search form • <form method="get" id="searchform" action="<?php echo home_url( '/' ); ?>"> • <label for="s"><?php _e("Search the site");?></label> • <input type="text" class="field" name="s" id="s" title="<?php _e("Search the site");?>" placeholder="<?php esc_attr_e( 'Search', 'twentyeleven' ); ?>" /> • <input type="submit" class="submit" name="submit" id="searchsubmit" value="<?php esc_attr_e( 'Search', 'twentyeleven' ); ?>" /> • </form>

  11. Accessible WordPress Theming - Pat Ramsey CSS for the form • Still allows for “clean” design, but doesn't remove elements from assistive tech: • #searchForm label, • #branding #searchsubmit { • position:absolute; • margin-left:-9999px; • }

  12. Links • Tendency to not underline links. • Rarely is the :focus selector used

  13. Links – CSS • TwentyEleven: • a { • color: #1b8be0;text-decoration: none; • } • a:focus,a:active,a:hover { • text-decoration: underline; • }

  14. Links – improved • a {color: #1b8be0;text-decoration: underline;} • a:focus,a:hover {color:#800;} • a:active {color:#c00;} • a:visited {color:#122b61;}

  15. Outline • Outline is set to 0 by default. • Use :focus pseudo-class :focus {outline:1px dotted #000;}

  16. Accessible WordPress Theming - Pat Ramsey Comment Form • Called by function comment_form(); • Can be customized in your functions.php • Copy the comment_form function in comment-template.php (in wp-includes)

  17. Accessible WordPress Theming - Pat Ramsey Read More... • An excerpt ends with [...] by default. • You may need to customize this. • excerpt_more() • Replace the […] with text, links, &hellip;, etc. • You can replace “Read more...” with something more descriptive • excerpt_length() • Control how long the excerpt is (in words).

  18. Accessible WordPress Theming - Pat Ramsey Internationalization (I18n) • For words that are in your theme templates, make them translatable. • __() $foo = __('Hello World'); • Content that is being passed to another function • _e() <label><?php _e('First Name'); ?></label> • Content that is rendering on the page

  19. Accessible WordPress Theming - Pat Ramsey Bonus Round • Making changes to the back-end admin_enqueue_script(); • Inject code into the head of the admin add_action('admin_enqueue_scripts','access_fix'); function access_fix() { echo'<link rel="stylesheet" type="text/css" href="'.get_bloginfo('template_directory').'/access.css" />'; wp_enqueue_script( 'access', get_bloginfo('template_directory') .'/js/access.js', array('jquery'), '1.0', false ); }

  20. Accessible WordPress Theming - Pat Ramsey add_action('admin_enqueue_scripts','access_fix'); function access_fix() { echo'<link rel="stylesheet" type="text/css" href="'.get_bloginfo('template_directory').'/access.css" />'; wp_enqueue_script( 'access', get_bloginfo('template_directory') .'/js/access.js', array('jquery'), '1.0', false ); }

  21. Accessible WordPress Theming - Pat Ramsey add_action('admin_menu', 'my_admin_menu'); function my_admin_menu() { $page_title = ''; $menu_title = 'Skip to Main Content'; $capability = 'read'; $menu_slug = '#wpbody-content'; $function = ''; $icon_url = ''; $position = '0'; add_menu_page( $page_title, $menu_title, $capability, $menu_slug, $function, $icon_url, $position ); } Skipnav on the backend?

  22. Accessible WordPress Theming - Pat Ramsey http://www.w3.org/TR/WCAG20/ http://make.wordpress.org/accessibility/ http://codex.wordpress.org/Accessibility http://codex.wordpress.org/I18n_for_WordPress_Developers http://codex.wordpress.org/Function_Reference/comment_form http://codex.wordpress.org/Function_Reference/get_search_form http://codex.wordpress.org/Administration_Menus http://codex.wordpress.org/Creating_Admin_Themes Resources

More Related