Skip to content

Commit

Permalink
a11y additions
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuaiz committed Nov 13, 2018
1 parent e27182e commit 887cf08
Show file tree
Hide file tree
Showing 13 changed files with 582 additions and 11 deletions.
Binary file modified CHANGELOG.html
Binary file not shown.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Expand Up @@ -6,6 +6,13 @@ Author: Joshua Michaels for studio.bio with help from Jon Iler

*******************************************************************

### 1.3.3 2018-11-13
- added a11y.js enqueue for expanded accessibility support (👍)
- added accessibility-ready patterns from the WP theme guide
- updated header.php with ARIA values and screen reader text
- updated 'Read More' function with ARIA setting
- fixed an issue where my workspace needed a tidy

### 1.3.2 2018-11-12
- added default editor styles in _gutenberg.scss to match front end
- updated header to allow for non-blocking scripts
Expand Down
32 changes: 24 additions & 8 deletions functions.php
Expand Up @@ -426,6 +426,9 @@ function plate_scripts_and_styles() {
// adding scripts file in the footer
wp_enqueue_script( 'plate-js', get_theme_file_uri() . '/library/js/scripts.js', array( 'jquery' ), '', true );

// accessibility (a11y) scripts
wp_enqueue_script( 'plate-a11y', get_theme_file_uri() . '/library/js/a11y.js', array( 'jquery' ), '', true );

$wp_styles->add_data( 'plate-ie-only', 'conditional', 'lt IE 9' ); // add conditional wrapper around ie stylesheet

// plate extra scripts. Uncomment to use. Or better yet, copy what you need to the main scripts folder or on the page(s) you need it
Expand Down Expand Up @@ -473,9 +476,9 @@ function plate_block_editor_styles() {

function plate_gutenberg_styles() {
if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
wp_enqueue_style( 'plate-gutenbers-styles', get_theme_file_uri( '/library/css/gutenberg.css' ), false, '1.0', 'all' );
wp_enqueue_style( 'plate-gutenberg-styles', get_theme_file_uri( '/library/css/gutenberg.css' ), false, '1.0', 'all' );
} else {
wp_enqueue_style( 'plate-gutenbers-styles', get_theme_file_uri( '/library/css/gutenberg.min.css' ), false, '1.0', 'all' );
wp_enqueue_style( 'plate-gutenberg-styles', get_theme_file_uri( '/library/css/gutenberg.min.css' ), false, '1.0', 'all' );
}

}
Expand Down Expand Up @@ -572,15 +575,28 @@ function plate_filter_ptags_on_images( $content ) {
}


// This removes the annoying […] to a Read More link
function plate_excerpt_more( $more ) {

global $post;
if ( ! function_exists( 'plate_excerpt_more' ) && ! is_admin() ) :
/**
* Replaces "[...]" (appended to automatically generated excerpts) with ... and a 'Continue reading' link.
* Be sure to change the text domain to the one matching your theme.
*
* @since Your Theme 1.0
*
* @return string 'Continue reading' link prepended with an ellipsis.
*/
function plate_excerpt_more( $more ) {
$link = sprintf( '<a href="%1$s" class="more-link">%2$s</a>',
esc_url( get_permalink( get_the_ID() ) ),
/* translators: %s: Name of current post */
sprintf( __( 'Continue reading %s', 'platetheme' ), '<span class="screen-reader-text">' . get_the_title( get_the_ID() ) . '</span>' )
);
return ' &hellip; ' . $link;
}
add_filter( 'excerpt_more', 'yourtheme_excerpt_more' );

// edit here if you like
return '... <a class="excerpt-read-more" href="'. get_permalink( $post->ID ) . '" title="'. __( 'Read ', 'platetheme' ) . esc_attr( get_the_title( $post->ID ) ).'">'. __( 'Read more &raquo;', 'platetheme' ) .'</a>';
endif;

}


/*********************
Expand Down
7 changes: 5 additions & 2 deletions header.php
Expand Up @@ -82,9 +82,12 @@

</div>

<nav class="header-nav" role="navigation" itemscope itemtype="https://schema.org/SiteNavigationElement">
<nav class="header-nav primary-menu" role="navigation" itemscope itemtype="https://schema.org/SiteNavigationElement" aria-label="<?php _e( 'Primary Menu ', 'universal' ); ?>">

<?php // see all default args here: https://developer.wordpress.org/reference/functions/wp_nav_menu/ ?>
<?php // added primary menu marker for accessibility ?>
<h2 class="screen-reader-text"><?php _e( 'Primary Menu', 'universal' ); ?></h2>

<?php // see all default args here: https://developer.wordpress.org/reference/functions/wp_nav_menu/ ?>

<?php wp_nav_menu( array(

Expand Down
File renamed without changes.

0 comments on commit 887cf08

Please sign in to comment.