Problem changing heading level of post title
-
Hi,
There is a problem with heading level nesting in the wpspw_posts shortcut if the page where it is used uses h2 headings to separate sections. In this case the section headings are at the same level as the post title headings. This is inconvenient for screen reader users who want to skip to the next section by skipping to the next heading of a particular level. I am trying to modify the plugin to allow specification of the HTML tag used for each post title. This HTML element tag is hard-coded to h2 in templates/grid/design-[12]. I have added another parameter
to the wpspw-post shortcode and pass it to the template. To make this work I changed the style sheet to remove references to h2:--- a/assets/css/bdpw-public.css +++ b/assets/css/bdpw-public.css @@ -59,7 +59,7 @@ .wpspw-post-categories a:hover, .wpspw-post-categories a:focus{background: #333 !important;border-color: #333 !important;color: #fff !important;} .sp_wpspwpost_static h2, .sp_wpspwpost_slider h2 {margin: 5px 0 !important;line-height: 24px !important;padding-top: 0px !important;padding-bottom: 0px !important;} -.sp_wpspwpost_static h2.wpspw-post-title a, .sp_wpspwpost_slider h2.wpspw-post-title a{font-size: 20px !important;line-height: 24px !important;} +.sp_wpspwpost_static .wpspw-post-title a, .sp_wpspwpost_slider h2.wpspw-post-title a{font-size: 20px !important;line-height: 24px !important;} .wpspw-post-title a {text-decoration: none !important;border-bottom: 0px !important;} .wpspw-post-date {line-height: normal !important;padding: 5px 5px 5px 0;display: inline-block;text-transform: uppercase;color: #666;font-size: 12px;} @@ -120,7 +120,9 @@ .wpspw-pro-sp-static.wpspw-pro-sp-static{margin:0 0px;} /****************** Design-1 ********************/ .sp_wpspwpost_static.wpspw-design-1 .wpspw-post-grid-content{background:#fff; border:1px solid #ddd; float:left; width:100%;} -.sp_wpspwpost_static.wpspw-design-1 .wpspw-post-grid-content h2 a{color:#444; text-decoration:none;} +/* Replaced h2 with .wpspw-post-title so we can make the tag variable. */ +.sp_wpspwpost_static.wpspw-design-1 .wpspw-post-grid-content +.wpspw-post-title a{color:#444; text-decoration:none;} .sp_wpspwpost_static.wpspw-design-1 .wpspw-post-grid-content .wpspw-post-title, .sp_wpspwpost_static.wpspw-design-1 .wpspw-post-grid-content .wpspw-post-date, .sp_wpspwpost_static.wpspw-design-1 .wpspw-post-grid-content .wpspw-post-content {padding:0 15px;float: none;}
When I run this with h2 output appears as the unmodified version. When I change to h3 the h2 text gets larger. Since I changed the stylesheet to depend only on .wpspw-post-title, there is another style rule that is affecting h2. Can you tell me what it is?
For my purposes, it is okay that h3 in the posts list looks the same as h2. It is smaller than the h2 that is outside the posts list.
I have tried to determine the controlling CSS rule with Google Chrome Developer Tools, but I’m using the JAWS screen reader, and accessibility of Devtools isn’t the greatest.
Thanks.
Gary
The page I need help with: [log in to see the link]
- The topic ‘Problem changing heading level of post title’ is closed to new replies.