-
AuthorPosts
-
August 7, 2023 at 1:23 pm #1415706
Hi
I have been building the following site at owe.brother.design for a client. They’ve requested that archive pages have an H1 header for accessibility signposting reasons. Eg. https://owe.brother.design/project_entries/enabling-infrastructure/ needs Enabling Infrastructure at the top and https://owe.brother.design/sites/becket-st-enabling-development/ needs Development Opportunities as H1 headers.
I’m hoping you’ll able to help?
Thanks in advance.
Dominic
August 7, 2023 at 1:24 pm #1415707Forgot password; see private content.
August 8, 2023 at 2:36 am #1415779Hi,
Thanks for the link to your site. On both of your pages do you mean that you want the end of the breadcrumbs to be H1? This was the only place that I saw your terms Enabling Infrastructure, Development Opportunities.
I think that adding a H1 to the breadcrumbs would make it look odd unless you plan to use css so it doesn’t have the standard H1 styling. But if you include the title with the breadcrumbs you will have these terms in H1 automatically.Best regards,
MikeAugust 8, 2023 at 8:31 am #1415798Hi Mike
Not quite – I’d like to keep the breadcrumb as is but add an H1 heading between that and the post grid with the relevant heading title dynamically generated.
I guess it would require tweaking the archive.php?
Dominic
August 8, 2023 at 9:09 am #1415803I guess the difficulty is this:
On the Theme settings under Header/Header Layout/Title and Breadcrumbs, I have “Show only breadcrumbs selected”. I want to show a Title only on archive pages. So I need to modify the archive.php to make this happen I think.
Of course, I could change the setting under Header/Header Layout/Title and Breadcrumbs to show “header and breadcrumbs”, but that would mean manually selecting “breadcrumbs only” on every existing and future page, which isn’t great for management when the site is handed over to the client.
So I think a tweak to archive.php in my child theme is the most sophisticated solution. Any thoughts on that and any ideas on what I change it to?
Dominic
August 8, 2023 at 12:40 pm #1415815Hi,
If you only want the title to show on archive pages I would recommend selecting Enfold Theme Options ▸ Header ▸ Header Layout ▸ Header Title and Breadcrumbs and then use css to hide it from all page except archives, linke this:#top:not(.archive) .title_container .main-title.entry-title { display: none; }
Then I assume you will want to remove the text before the title on archive pages like Archive for category: , Tag Archive for: , Archive for: I recommend adding this code to the end of your child theme functions.php file in Appearance ▸ Editor:
function remove_archive_title_pre_text() { ?> <script> (function($){ $('#top.archive .title_container .main-title.entry-title a').contents().filter(function() { return this.nodeType == 3 }).each(function(){ this.textContent = this.textContent.replace('Archive for category:',''); this.textContent = this.textContent.replace('Tag Archive for:',''); this.textContent = this.textContent.replace('Archive for:',''); }); })(jQuery); </script> <?php } add_action('wp_footer', 'remove_archive_title_pre_text');
Best regards,
MikeAugust 8, 2023 at 12:43 pm #1415816Hi Mike
I found another way – I created an archive.php in my child theme and added –<h1 class="h1-as-h3"><?php post_type_archive_title(); ?></h1>
around line 35.Thanks for your help. I may come back and use this method if mine becomes problematic.
Dominic
- This reply was modified 1 year, 3 months ago by domchocolate.
August 8, 2023 at 5:38 pm #1415840Hi,
Glad to hear that you have this sorted out, if you have any further questions please create a new thread and we will gladly try to help you. Thank you for using Enfold.Best regards,
Mike -
AuthorPosts
- The topic ‘H1 headings on Archive pages for Accessbility’ is closed to new replies.