Your cart is currently empty!
Homepage › Community Forums › Epik Theme Support › where to add id="content" for skip links
Wes – I’m adding a couple accessibility features to a site, and need to place an id=”content” somewhere around the page title so users who navigate with keyboards/etc can jump past the menu. What’s the easiest way to do this?
Thanks,
Scott
I’ve actually never dealt with accessibility features before (so I’m probably the wrong person to ask). But if all you need is to add an ID, maybe you could do it the same way I did when I added the .head-wrap
in the functions file. Give that a try and see if that works.
Thanks Wes. Skip links for accessibility aren’t anything special. It’s just a “skip to content” link before everything else (which is hidden unless it receives keyboard focus), which then allows a user to skip over nav menus. Keyboard navigation is done by hitting Tab to move from link to link. Tabbing through menus can get cumbersome.
Anyway…
What you did in functions.php w/ the .head-wrap
stuff works by adding the id to the div, but I need to figure out how to do that with the post/page title instead of the site header. I don’t see what snippet even references the page title: http://my.studiopress.com/snippets/ – Any ideas?
I like Genesis, but it sure makes some things more complicated than necessary.
Take a look at the first code snippet here – http://my.studiopress.com/snippets/header/ …I’m not sure if that works with 2.0 or not, but if it does then you should be able to add your code inside the html part.
Thanks Wes, though I need an id on the page title, not the site title.
I know this should be directed to the SP team, but since we’re here… what about these? http://my.studiopress.com/snippets/entry-header/
I just need to change…
<h1 class="entry-title">Page Title</h1>
to…
<h1 class="entry-title" id="content">Page Title</h1>
Whoops, I thought you were talking about the site title this whole time 🙂
I did a ton of searches, and the only thing I can see is how to add or remove page titles…..but I haven’t seen anything that explains how to edit the page title in the way you need. I’m pretty sure this can be done, but I have no idea how. You’ll probably want to head over to the SP forum to see if one of the devs may know how to do this. If I come across anything I’ll post it here.
No problem. My bad if I could’ve been more clear.
I’ll ask the SP crew about this, as your findings are pretty much in line with mine.
See what I mean about Genesis making this more complicated than it needs to be? Haha.
Thanks Wes!
Scott
Here’s the solution…
add_filter( 'genesis_post_title_output', 'ac_post_title_output', 15 );
function ac_post_title_output( $title ) {
if ( is_singular() )
$title = sprintf( '<h1 class="entry-title" id="content">%s</h1>', apply_filters( 'genesis_post_title_text', get_the_title() ) );
return $title;
}
Great! I’ll reference this post if someone else needs it. Thanks for getting back with me.